#37416 [Csd]: Exception in rewind() method crashes iterator_to_array() function

From: Date: Fri, 12 May 2006 14:31:22 +0000
Subject: #37416 [Csd]: Exception in rewind() method crashes iterator_to_array() function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97018@lists.php.net to get a copy of this message
 ID:               37416
 User updated by:  suhachov at gmail dot com
 Reported By:      suhachov at gmail dot com
 Status:           Closed
 Bug Type:         SPL related
 Operating System: WinXP
 PHP Version:      5.1.4
 New Comment:

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...


Previous Comments:
------------------------------------------------------------------------

[2006-05-12 09:44:10] 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 08:07:50] 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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37416&edit=1


Thread (3 messages)

« previous php.bugs (#97018) next »