php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47341 Calling gc_collect_cycles() with zend.enable_gc=0 causes segfault
Submitted: 2009-02-08 19:06 UTC Modified: 2009-02-08 19:36 UTC
From: geoffers+phpbugs at gmail dot com Assigned: derick (profile)
Status: Closed Package: Reproducible crash
PHP Version: 5.3CVS-2009-02-08 (CVS) OS: Debian Etch
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: geoffers+phpbugs at gmail dot com
New email:
PHP Version: OS:

 

 [2009-02-08 19:06 UTC] geoffers+phpbugs at gmail dot com
Description:
------------
When running PHP with zend.enable_gc=0, a segfault occurs when trying to 
call gc_collect_cycles().

This is on Debian Etch, with everything apart from PHP 5.3 from the 
Debian stable repositories. PHP 5.3 was compiled with:

'./configure' '--enable-bcmath' '--enable-calendar' '--with-zlib-
dir=/usr' '--with-gd' '--with-apxs2=/usr/bin/apxs2' '--with-curl=/usr' 
'--without-pear' '--enable-mbstring' '--enable-debug'

I have only tested through the CLI using -d zend.enable_gc=0.

Reproduce code:
---------------
<?php
gc_collect_cycles();
?>

Expected result:
----------------
I would expect that PHP didn't crash!

Beyond that, I'd expect the result to be the same as the following when 
zend.enable_gc=1:

<?php
gc_disable();
gc_collect_cycles();
?>

which is to say that it silently fails (and returns 0).

Actual result:
--------------
Segfault:

#0  0x08449a83 in gc_mark_roots () at /root/php5/Zend/zend_gc.c:363
#1  0x0844a05e in gc_collect_cycles () at 
/root/php5/Zend/zend_gc.c:539
#2  0x08439ab6 in zif_gc_collect_cycles (ht=0, 
return_value=0xb79301ac, return_value_ptr=0x0, this_ptr=0x0, 
return_value_used=0)
    at /root/php5/Zend/zend_builtin_functions.c:336
#3  0x084536a5 in zend_do_fcall_common_helper_SPEC 
(execute_data=0xb77b8048) at /root/php5/Zend/zend_vm_execute.h:313
#4  0x084581ea in ZEND_DO_FCALL_SPEC_CONST_HANDLER 
(execute_data=0xb77b8048) at /root/php5/Zend/zend_vm_execute.h:1564
#5  0x08452ae2 in execute (op_array=0xb79307d8) at 
/root/php5/Zend/zend_vm_execute.h:104
#6  0x084286de in zend_execute_scripts (type=8, retval=0x0, 
file_count=3) at /root/php5/Zend/zend.c:1181
#7  0x083bce0c in php_execute_script (primary_file=0xbfb8bce4) at 
/root/php5/main/main.c:2147
#8  0x084b8e4b in main (argc=4, argv=0xbfb8be34) at 
/root/php5/sapi/cli/php_cli.c:1159


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-08 19:07 UTC] geoffers+phpbugs at gmail dot com
Woops, should be 5.3CVS not 5.2CVS
 [2009-02-08 19:36 UTC] derick@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.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 21 12:00:03 2025 UTC