php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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 commitsRelated reports
 [2006-05-12 09:44 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Just for the record: "crash" is something different.
"Fatal error in Unknown" is not a crash.
 [2006-05-12 14:31 UTC] suhachov at gmail dot com
Ok, snapshot is good, but when (and where) can I get compiled PHP binaries for Win32 with this bug fixed?
I'm afraid I can't build PHP for Win32 right now, I havn't got MSVC... :(

>Just for the record: "crash" is something different.
Ok, thank you. Sorry for my English :( It was the first word that came into my head...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC