php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52238 Crash when an Exception occured in iterator_to_array
Submitted: 2010-07-02 20:27 UTC Modified: 2010-07-02 21:20 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: php-bugs at majkl578 dot cz Assigned: johannes (profile)
Status: Closed Package: Reproducible crash
PHP Version: 5.3.2 OS: Linux Debian
Private report: No CVE-ID: None
 [2010-07-02 20:27 UTC] php-bugs at majkl578 dot cz
Description:
------------
PHP crashes when an Exception is thrown from IteratorAggregate::getIterator() and passed to iterator_to_array().

Test script:
---------------
class Foo implements IteratorAggregate
{
	public function bar()
	{
		throw new Exception;
	}
	
	public function getIterator()
	{
		return new ArrayIterator($this->bar());
	}
}

var_dump(iterator_to_array(new Foo));

Expected result:
----------------
Uncaught Exception

Actual result:
--------------
PHP crashed

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-02 20:46 UTC] php-bugs at majkl578 dot cz
Backtrace:

#0  spl_iterator_apply (obj=0x93d610c, 
    apply_func=0xb7064140 <spl_iterator_to_array_apply>, puser=0x93d6170)
    at /tmp/buildd/php5-5.3.2/ext/spl/spl_iterators.c:3038
#1  0xb70660fd in zif_iterator_to_array (ht=1, return_value=0x93d6170, 
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
    at /tmp/buildd/php5-5.3.2/ext/spl/spl_iterators.c:3111
#2  0xb719cddb in execute_internal (execute_data_ptr=0x941bcbc, 
    return_value_used=1) at /tmp/buildd/php5-5.3.2/Zend/zend_execute.c:1260
#3  0xb6756aac in xdebug_execute_internal (current_execute_data=0x941bcbc, 
    return_value_used=1)
    at /build/buildd-xdebug_2.0.5-1+b1-i386-VWnNbE/xdebug-2.0.5/build-php5/xdebug.c:1631
#4  0xb33bced3 in ?? () from /usr/lib/php5/20090626+lfs/suhosin.so
#5  0xb71c8a18 in zend_do_fcall_common_helper_SPEC (execute_data=0x12)
    at /tmp/buildd/php5-5.3.2/Zend/zend_vm_execute.h:315
#6  0xb719f77e in execute (op_array=0x93d6028)
    at /tmp/buildd/php5-5.3.2/Zend/zend_vm_execute.h:104
#7  0xb6756765 in xdebug_execute (op_array=0x93d6028)
    at /build/buildd-xdebug_2.0.5-1+b1-i386-VWnNbE/xdebug-2.0.5/build-php5/xdebug.c:1562
#8  0xb33bd334 in ?? () from /usr/lib/php5/20090626+lfs/suhosin.so
#9  0xb71758e6 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /tmp/buildd/php5-5.3.2/Zend/zend.c:1266
#10 0xb7119ff4 in php_execute_script (primary_file=0xbfe11fd4)
    at /tmp/buildd/php5-5.3.2/main/main.c:2288
#11 0xb7207d9b in php_handler (r=0x9412cc8)
    at /tmp/buildd/php5-5.3.2/sapi/apache2handler/sapi_apache2.c:674
#12 0x0807cb96 in ap_run_handler ()
#13 0x08080311 in ap_invoke_handler ()
#14 0x0808e390 in ap_process_request ()
#15 0x0808b3a0 in ?? ()
#16 0x080846e6 in ap_run_process_connection ()
#17 0x080930f8 in ?? ()
#18 0x0809344b in ?? ()
#19 0x0809423c in ap_mpm_run ()
#20 0x080696a4 in main ()
 [2010-07-02 20:49 UTC] giorgio dot liscio at email dot it
crashes on windows x64 with php 5.3.2 installed as module on apache 2
 [2010-07-02 21:17 UTC] johannes@php.net
Automatic comment from SVN on behalf of johannes
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=300951
Log: Fix bug #52238: Crash when an Exception occured in iterator_to_array
 [2010-07-02 21:20 UTC] johannes@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: johannes
 [2010-07-02 21:20 UTC] johannes@php.net
Fixed in 5.2, 5.3 and trunk.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC