php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58362 APC crashes (during compile phase?) when using Closures with use ($vars) syntax
Submitted: 2008-10-03 14:58 UTC Modified: 2008-10-03 19:48 UTC
From: phpbugs at sevenlight dot com Assigned:
Status: Closed Package: APC (PECL)
PHP Version: 5_3 CVS-2008-10-03 (dev) OS: OSX 10.5.5
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: phpbugs at sevenlight dot com
New email:
PHP Version: OS:

 

 [2008-10-03 14:58 UTC] phpbugs at sevenlight dot com
Description:
------------
PHP version is actually 5.3.0-alpha2, but it was not in the list.

Was running a small script and then installed APC and then it was crashing.  Narrowed it down to using the syntax:

$a = function () use ($vars) {
   ...
};

*OR*

callbac_func(function () use ($vars) {
    ...
});

If you do not use the "use ($vars)" portion, it would not crash.

Reproduce code:
---------------
<?php
$a = "Hello, Closures!";
$b = function() use ($a) {
    echo $a;
};
?>

Expected result:
----------------
Hello, Closures!

Actual result:
--------------
Program received signal SIGABRT, Aborted.
0x910efb9e in __kill ()
(gdb) bt 
#0  0x910efb9e in __kill ()
#1  0x910efb91 in kill$UNIX2003 ()
#2  0x91166ec2 in raise ()
#3  0x9117647f in abort ()
#4  0x91168063 in __assert_rtn ()
#5  0x007c1d54 in my_copy_zval (dst=0x1b0acf0, src=0x74d8b0, allocate=0x7c8efa <apc_sma_malloc>, deallocate=0x7c92a6 <apc_sma_free>) at /usr/local/src/APC-3.0.19/apc_compile.c:401
#6  0x007c1a38 in my_copy_zval_ptr (dst=0x1b0acd8, src=0x74de9c, allocate=0x7c8efa <apc_sma_malloc>, deallocate=0x7c92a6 <apc_sma_free>) at /usr/local/src/APC-3.0.19/apc_compile.c:310
#7  0x007c32ea in my_copy_hashtable_ex (dst=0x1b0ac30, src=0x74ee34, copy_fn=0x7c1948 <my_copy_zval_ptr>, free_fn=0x7c5467 <my_free_zval_ptr>, holds_ptrs=1, allocate=0x7c8efa <apc_sma_malloc>, deallocate=0x7c92a6 <apc_sma_free>, check_fn=0) at /usr/local/src/APC-3.0.19/apc_compile.c:1026
#8  0x007c34a1 in my_copy_static_variables (src=0x3929ea0, allocate=0x7c8efa <apc_sma_malloc>, deallocate=0x7c92a6 <apc_sma_free>) at /usr/local/src/APC-3.0.19/apc_compile.c:1087
#9  0x007c3f6f in apc_copy_op_array (dst=0x1b0a9d8, src=0x3929ea0, allocate=0x7c8efa <apc_sma_malloc>, deallocate=0x7c92a6 <apc_sma_free>) at /usr/local/src/APC-3.0.19/apc_compile.c:1365
#10 0x007c212e in my_copy_function (dst=0x1b0a9d8, src=0x3929ea0, allocate=0x7c8efa <apc_sma_malloc>, deallocate=0x7c92a6 <apc_sma_free>) at /usr/local/src/APC-3.0.19/apc_compile.c:478
#11 0x007c4546 in apc_copy_new_functions (old_count=1218, allocate=0x7c8efa <apc_sma_malloc>, deallocate=0x7c92a6 <apc_sma_free>) at /usr/local/src/APC-3.0.19/apc_compile.c:1494
#12 0x007c768d in my_compile_file (h=0xbffff60c, type=8) at /usr/local/src/APC-3.0.19/apc_main.c:446
#13 0x0119fbd7 in phar_compile_file ()
#14 0x014205a1 in zend_execute_scripts ()
#15 0x013a2d84 in php_execute_script ()
#16 0x014baa5b in php_handler ()
#17 0x000161c9 in ap_run_handler (r=0x9ff250) at config.c:157
#18 0x000165d9 in ap_invoke_handler (r=0x9ff250) at config.c:372
#19 0x0006a697 in ap_process_request (r=0x9ff250) at http_request.c:258
#20 0x0004c7c1 in ap_process_http_connection (c=0x9f95b8) at http_core.c:184
#21 0x0001d5de in ap_run_process_connection (c=0x9f95b8) at connection.c:43
#22 0x0001d940 in ap_process_connection (c=0x9f95b8, csd=0x9f9250) at connection.c:178
#23 0x0004e6fa in child_main (child_num_arg=0) at prefork.c:640
#24 0x0004e9bb in make_child (s=0x4e2cd, slot=0) at prefork.c:680
#25 0x0004f531 in ap_mpm_run (_pconf=0x806018, plog=0x848018, s=0x80c198) at prefork.c:956
#26 0x000027cc in main (argc=2, argv=0xbffffb24) at main.c:717


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-03 19:48 UTC] shire@php.net
I believe this is fixed with the latest CVS version of APC, please try out that version and let us know if you're still having problems.  Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 14:01:33 2025 UTC