php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55425 closure with use of referenced array -> SEGV
Submitted: 2011-08-15 16:00 UTC Modified: 2011-08-18 07:11 UTC
From: ajrattink at correct dot net Assigned: laruence (profile)
Status: Closed Package: Reproducible crash
PHP Version: 5.3.6 OS: linux2.4.25
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ajrattink at correct dot net
New email:
PHP Version: OS:

 

 [2011-08-15 16:00 UTC] 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 ()


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-16 04:54 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2011-08-16 04:54 UTC] 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-16 12:43 UTC] ajrattink at correct dot net
Tested with 5.3.7RC5, no more SEGV.
 [2011-08-18 07:11 UTC] laruence@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: laruence
 [2011-08-18 07:11 UTC] laruence@php.net
okey, well, I am going to close this report
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 20:01:33 2025 UTC