Bug #55425 [Com]: closure with use of referenced array -> SEGV
| From: | ajrattink at correct dot net | Date: | Tue, 16 Aug 2011 12:43:30 +0000 |
| Subject: | Bug #55425 [Com]: closure with use of referenced array -> SEGV | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162618@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55425&edit=1
ID: 55425
Comment by: ajrattink at correct dot net
Reported by: ajrattink at correct dot net
Summary: closure with use of referenced array -> SEGV
Status: Feedback
Type: Bug
Package: Reproducible crash
Operating System: linux2.4.25
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Tested with 5.3.7RC5, no more SEGV.
Previous Comments:
------------------------------------------------------------------------
[2011-08-16 04:54:28] laruence@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Hi, I can reproduct this in php 5.3.6, and I have a quick look at php 5.3.7, seems
there is no such issue in PHP 5.3.7, so plz try with php 5.3.7.
------------------------------------------------------------------------
[2011-08-15 16:00:53] ajrattink at correct dot net
Description:
------------
If you reference an array (with instances) and 'use' that array in a closure (without
referencing it again) you get a segmentation fault
Using 'use (&$ar)' iso 'use ($ar)' fixes it.
Test script:
---------------
http://www.correct.nl/bug_closure_b338f79f99c96c55fc879211ca2fe370.php.txt
Expected result:
----------------
exit 0, I guess
Actual result:
--------------
SEGV, gdb where ->
#0 0x0827e6ff in zend_objects_store_del_ref_by_handle_ex ()
#1 0x0827e684 in zend_objects_store_del_ref ()
#2 0x082595a3 in _zval_dtor_func ()
#3 0x0824d238 in _zval_dtor ()
#4 0x0824d464 in _zval_ptr_dtor ()
#5 0x0826692a in _zend_hash_index_update_or_next_insert ()
#6 0x082677df in zend_hash_copy ()
#7 0x0825971f in _zval_copy_ctor_func ()
#8 0x0827f259 in _zval_copy_ctor ()
#9 0x08299456 in zend_send_by_var_helper_SPEC_VAR ()
#10 0x08299e34 in ZEND_SEND_VAR_SPEC_VAR_HANDLER ()
#11 0x08280901 in execute ()
#12 0x0825b513 in zend_execute_scripts ()
#13 0x0820088b in php_execute_script ()
#14 0x082ff885 in main ()
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55425&edit=1