File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
spl /
tests /
heap_004.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:01 2012 UTC (13 years, 2 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
SPL: SplHeap: exceptions
--FILE--
<?php
class myHeap extends SplHeap {
public function compare($a, $b) {
throw new exception("foo");
}
}
$h = new myHeap;
try {
$h->insert(1);
echo "inserted 1\n";
$h->insert(2);
echo "inserted 2\n";
$h->insert(3);
echo "inserted 3\n";
} catch(Exception $e) {
echo "Exception: ".$e->getMessage()."\n";
}
try {
$h->insert(4);
echo "inserted 4\n";
} catch(Exception $e) {
echo "Exception: ".$e->getMessage()."\n";
}
try {
var_dump($h->extract());
} catch(Exception $e) {
echo "Exception: ".$e->getMessage()."\n";
}
try {
var_dump($h->extract());
} catch(Exception $e) {
echo "Exception: ".$e->getMessage()."\n";
}
echo "Recovering..\n";
$h->recoverFromCorruption();
try {
var_dump($h->extract());
} catch(Exception $e) {
echo "Exception: ".$e->getMessage()."\n";
}
try {
var_dump($h->extract());
} catch(Exception $e) {
echo "Exception: ".$e->getMessage()."\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
inserted 1
Exception: foo
Exception: Heap is corrupted, heap properties are no longer ensured.
Exception: Heap is corrupted, heap properties are no longer ensured.
Exception: Heap is corrupted, heap properties are no longer ensured.
Recovering..
int(1)
int(2)
===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>