Exception in rewind() method crashes iterator_to_array() function
| Bug #37416 | Exception in rewind() method crashes iterator_to_array() function | ||||
|---|---|---|---|---|---|
| Submitted: | 2006-05-12 08:07 UTC | Modified: | 2006-05-12 14:31 UTC | ||
| From: | suhachov at gmail dot com | Assigned: | |||
| Status: | Closed | Package: | SPL related | ||
| PHP Version: | 5.1.4 | OS: | WinXP | ||
| Private report: | No | CVE-ID: | None | ||
[2006-05-12 08:07 UTC] suhachov at gmail dot com
Description: ------------ I call iterator_to_array($iter) and if something bad is happend in rewind() function and exception is thrown, script dies instead of throwing the exception. It looks like bug #32993 but it should be fixed still in PHP 5.0 Reproduce code: --------------- <? class MyIterator implements Iterator { public function rewind () # void { throw new Exception("Oops!"); } public function valid () # bool { return 0; } public function current () # object { return NULL; } public function key () # void { return 0; } public function next () # void { } } var_dump(iterator_to_array(new MyIterator)); ?> Expected result: ---------------- Exception stack trace Actual result: -------------- Fatal error: Couldn't execute method MyIterator::valid in Unknown on line 0
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2006-05-12 09:44 UTC] tony2001@php.net
[2006-05-12 14:31 UTC] suhachov at gmail dot com