php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67215 php-cgi work with opcache, may be segmentation fault happen
Submitted: 2014-05-06 12:21 UTC Modified: -
From: dailei6200 at 163 dot com Assigned:
Status: Closed Package: opcache
PHP Version: 5.5.12 OS: CentOS 6.5 x86_64
Private report: No CVE-ID: None
 [2014-05-06 12:21 UTC] dailei6200 at 163 dot com
Description:
------------
php-cgi work with opcache, may be segmentation fault happen

[dailei@Ideal core]$ gdb /usr/local/php-5.5.12/bin/php-cgi
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/php-5.5.12/bin/php-cgi...done.
(gdb) run index.php 
Starting program: /usr/local/php-5.5.12/bin/php-cgi index.php
[Thread debugging using libthread_db enabled]
PHP Fatal error:  Cannot redeclare class c in /home/dailei/Project/core/c.class.php on line 0
Status: 500 Internal Server Error
Content-type: text/html


Program received signal SIGSEGV, Segmentation fault.
_zval_ptr_dtor (zval_ptr=0x7ffff7fd9558) at /usr/local/src/php-5.5.12/Zend/zend_execute_API.c:426
426		i_zval_ptr_dtor(*zval_ptr ZEND_FILE_LINE_RELAY_CC);
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6.x86_64 libxml2-2.7.6-14.el6.x86_64 nss-softokn-freebl-3.14.3-10.el6_5.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) bt
#0  _zval_ptr_dtor (zval_ptr=0x7ffff7fd9558) at /usr/local/src/php-5.5.12/Zend/zend_execute_API.c:426
#1  0x00000000006f4c57 in zend_object_std_dtor (object=0x7ffff7fd7ba8) at /usr/local/src/php-5.5.12/Zend/zend_objects.c:54
#2  0x00000000006f4c89 in zend_objects_free_object_storage (object=0x7ffff7fd7ba8) at /usr/local/src/php-5.5.12/Zend/zend_objects.c:137
#3  0x00000000006fa938 in zend_objects_store_del_ref_by_handle_ex (handle=1, handlers=<value optimized out>) at /usr/local/src/php-5.5.12/Zend/zend_objects_API.c:226
#4  0x00000000006fa953 in zend_objects_store_del_ref (zobject=0x7ffff7fd8870) at /usr/local/src/php-5.5.12/Zend/zend_objects_API.c:178
#5  0x00000000006c2c80 in _zval_dtor (zval_ptr=<value optimized out>) at /usr/local/src/php-5.5.12/Zend/zend_variables.h:35
#6  i_zval_ptr_dtor (zval_ptr=<value optimized out>) at /usr/local/src/php-5.5.12/Zend/zend_execute.h:81
#7  _zval_ptr_dtor (zval_ptr=<value optimized out>) at /usr/local/src/php-5.5.12/Zend/zend_execute_API.c:426
#8  0x00000000006def0b in zend_hash_clean (ht=0x7ffff7fd88a0) at /usr/local/src/php-5.5.12/Zend/zend_hash.c:596
#9  0x00000000006c7b9b in zend_cleanup_op_array_data (function=<value optimized out>) at /usr/local/src/php-5.5.12/Zend/zend_opcode.c:134
#10 zend_cleanup_function_data (function=<value optimized out>) at /usr/local/src/php-5.5.12/Zend/zend_opcode.c:141
#11 0x00000000006de8e4 in zend_hash_reverse_apply (ht=0xdedc30, apply_func=0x6c7b70 <zend_cleanup_function_data>) at /usr/local/src/php-5.5.12/Zend/zend_hash.c:799
#12 0x00000000006c56cb in shutdown_executor () at /usr/local/src/php-5.5.12/Zend/zend_execute_API.c:286
#13 0x00000000006d1af2 in zend_deactivate () at /usr/local/src/php-5.5.12/Zend/zend.c:935
#14 0x000000000067323c in php_request_shutdown (dummy=<value optimized out>) at /usr/local/src/php-5.5.12/main/main.c:1808
#15 0x0000000000781d05 in main (argc=2, argv=0x7fffffffe258) at /usr/local/src/php-5.5.12/sapi/cgi/cgi_main.c:2505




Test script:
---------------
index.php
<?php
require __DIR__ . '/c.class.php';
function getClass() {
    static $cache = NULL;
    $cache = new c();
}
getClass();
require __DIR__ . '/c.class.php';
-------------------------------------------
p.class.php
<?php
class p {
    protected $_keyspace    = '';
}
-------------------------------------------
c.class.php
<?php
require __DIR__ . '/p.class.php';
class c extends p {
}



Expected result:
----------------
opcache.enable = Off

[dailei@Ideal core]$ /usr/local/php-5.5.12/bin/php-cgi index.php 
PHP Fatal error:  Cannot redeclare class c in /home/dailei/Project/core/c.class.php on line 7
Status: 500 Internal Server Error
Content-type: text/html

[dailei@Ideal core]$ echo $?
255

Actual result:
--------------
opcache.enable = On

[dailei@Ideal core]$ /usr/local/php-5.5.12/bin/php-cgi index.php 
PHP Fatal error:  Cannot redeclare class c in /home/dailei/Project/core/c.class.php on line 0
Status: 500 Internal Server Error
Content-type: text/html

段错误 (core dumped)
[dailei@Ideal core]$ echo $?
139


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-03 06:59 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2034ace0526657cbed0fafc3d77b1baa6604ae9e
Log: Fixed bug #67215 (php-cgi work with opcache, may be segmentation fault happen)
 [2014-07-03 06:59 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2014-07-07 15:22 UTC] dmitry@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2034ace0526657cbed0fafc3d77b1baa6604ae9e
Log: Fixed bug #67215 (php-cgi work with opcache, may be segmentation fault happen)
 [2014-07-21 09:31 UTC] ab@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2034ace0526657cbed0fafc3d77b1baa6604ae9e
Log: Fixed bug #67215 (php-cgi work with opcache, may be segmentation fault happen)
 [2014-07-21 10:02 UTC] ab@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2034ace0526657cbed0fafc3d77b1baa6604ae9e
Log: Fixed bug #67215 (php-cgi work with opcache, may be segmentation fault happen)
 [2014-07-30 09:52 UTC] tyrael@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2034ace0526657cbed0fafc3d77b1baa6604ae9e
Log: Fixed bug #67215 (php-cgi work with opcache, may be segmentation fault happen)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC