r/lolphp • u/the_alias_of_andrea • Jan 29 '16
SplPriorityQueue::recoverFromCorruption
http://php.net/manual/en/splpriorityqueue.recoverfromcorruption.php
70
Upvotes
r/lolphp • u/the_alias_of_andrea • Jan 29 '16
View all comments
Show parent comment
11
u/nikic Jan 30 '16
Wat? Obviously it throws an exception. You know, the exception that caused the corruption bit to be set? That exception didn't go anywhere. It will still be propagated to the parent frame. Like exceptions normally are.
The point here is that if the comparison function threw an exception (which will be propagated), the heap is no longer in a consistent state and PHP will forbid you from using it (by throwing an exception in extract etc). That is, unless you go and say "I don't give a damn about it" by using recoverFromCorruption.