|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-03-27 10:56 UTC] l dot alberton at quipo dot it
Description:
------------
I was trying the latest SPL features, but every time I call the next() method of a SplHeap object (SplMaxHeap, SplMinHeap, SplPriorityQueue), I get a crash.
Reproduce code:
---------------
$heap = new SplMaxHeap();
$heap->insert('a');
$heap->insert('b');
$heap->insert('c');
$heap->rewind();
echo $heap->current();
$heap->next(); //crash
echo $heap->current();
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 06:00:01 2025 UTC |
I think I have a better reproducing script: ================================= $pqueue = new SplPriorityQueue(); $pqueue->insert('a', 1); $pqueue->insert('b', 2); try { echo $pqueue->extract(); echo $pqueue->extract(); echo $pqueue->extract(); } catch (RuntimeException $e) { echo "\nERROR: ".$e->getMessage(); } ================================= Here, I insert 2 elements in the queue, and try to extract 3 elements. The last extract() call should trigger a RuntimeException, and this is the case when running the script from the command line. When running it in a web browser, Apache crashes. HTH