Edit report at https://bugs.php.net/bug.php?id=72257&edit=1
ID: 72257
Updated by: laruence@php.net
Reported by: jccgls001 at 126 dot com
Summary: "get_defined_constants(true)" core dump
-Status: Open
+Status: Feedback
Type: Bug
Package: Scripting Engine problem
Operating System: linux 2.6
PHP Version: 7.0.6
Block user comment: N
Private report: N
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
I can not reproduce this.
Previous Comments:
------------------------------------------------------------------------
[2016-05-23 07:39:24] jccgls001 at 126 dot com
Description:
------------
hi,
I find that when using "get_defined_constants()" function with args "true", zend
core will dump. the code like this :
var_dump(get_defined_constants(true));
---------------------------------------------------------
About debug detail:
I debug the code with gdb and find, this bug maybe caused by
"zend_startup_builtin_functions()" in zend_builtin_functions.c(line 362), which the code :
zend_builtin_module.module_number = 0;
this place assign module index to 0, which will cause "get_defined_constants(true)" dump.
Because in this function, the 0 index is reserved to "internal".
----------------------------------------------------------
About fix:
I think the code in zend_builtin_functions.c(line 362) can be modified to:
zend_builtin_module.module_number = zend_next_free_module();
this will lead index to 1, and can make "get_defined_constants(true)" run correctly.
Test script:
---------------
get_defined_constants(true);
Expected result:
----------------
two dimension array that contains all defined constants group by module's name
Actual result:
--------------
segmentation fault and core dump
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72257&edit=1