1--TEST-- 2SPL: SplPriorityQueue: exceptions 3--FILE-- 4<?php 5class myPQueue extends SplPriorityQueue { 6 public function compare($a, $b) { 7 throw new exception("foo"); 8 } 9} 10 11$h = new myPQueue; 12 13try { 14 $h->insert(1, 1); 15 echo "inserted 1\n"; 16 $h->insert(2, 1); 17 echo "inserted 2\n"; 18 $h->insert(3, 1); 19 echo "inserted 3\n"; 20} catch(Exception $e) { 21 echo "Exception: ".$e->getMessage()."\n"; 22} 23 24try { 25 $h->insert(4, 1); 26 echo "inserted 4\n"; 27} catch(Exception $e) { 28 echo "Exception: ".$e->getMessage()."\n"; 29} 30 31try { 32 var_dump($h->extract()); 33} catch(Exception $e) { 34 echo "Exception: ".$e->getMessage()."\n"; 35} 36try { 37 var_dump($h->extract()); 38} catch(Exception $e) { 39 echo "Exception: ".$e->getMessage()."\n"; 40} 41 42echo "Recovering..\n"; 43$h->recoverFromCorruption(); 44 45try { 46 var_dump($h->extract()); 47} catch(Exception $e) { 48 echo "Exception: ".$e->getMessage()."\n"; 49} 50try { 51 var_dump($h->extract()); 52} catch(Exception $e) { 53 echo "Exception: ".$e->getMessage()."\n"; 54} 55?> 56===DONE=== 57<?php exit(0); ?> 58--EXPECT-- 59inserted 1 60Exception: foo 61Exception: Heap is corrupted, heap properties are no longer ensured. 62Exception: Heap is corrupted, heap properties are no longer ensured. 63Exception: Heap is corrupted, heap properties are no longer ensured. 64Recovering.. 65int(1) 66int(2) 67===DONE=== 68