#29803 [Sus->WFx]: Seg fault on count($GLOBALS, COUNT_RECURSIVE);

From: Date: Fri, 06 Jan 2006 08:13:09 +0000
Subject: #29803 [Sus->WFx]: Seg fault on count($GLOBALS, COUNT_RECURSIVE);
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91614@lists.php.net to get a copy of this message
ID: 29803 Updated by: derick@php.net Reported By: jome@php.net -Status: Suspended +Status: Wont fix Bug Type: Scripting Engine problem Operating System: * PHP Version: 6CVS, 5CVS (2006-01-02) (cvs) Assigned To: derick New Comment: I still have no clue, so marking it as "Wont Fix" Previous Comments: ------------------------------------------------------------------------ [2004-08-24 09:33:32] jome@php.net Understood. I don't know much about the internals but like I mentioned, it works if you do var_dump($GLOBALS) though (ie PHP doesn't crash). ------------------------------------------------------------------------ [2004-08-24 09:27:49] derick@php.net So, PHP is allowed to crash here as you're doing something infinite recursive... I have no clue how this should or can be fixed while the function is still useful. Suspending for now. ------------------------------------------------------------------------ [2004-08-24 09:16:26] jome@php.net Let me know of you need more than this. (gdb) frame 1 #1 0x0806936a in php_count_recursive (array=0x81910d4, mode=1) at /usr/local/src/php5-200408231830/ext/standard/array.c:267 267 for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos); (gdb) frame 2 #2 0x08069382 in php_count_recursive (array=0x81910d4, mode=1) at /usr/local/src/php5-200408231830/ext/standard/array.c:270 270 cnt += php_count_recursive(*element, COUNT_RECURSIVE TSRMLS_CC); (More frames containing the above here.) (gdb) frame 174531 #174531 0x0806942b in zif_count (ht=2, return_value=0x81c3d74, this_ptr=0x0, return_value_used=0) at /usr/local/src/php5-200408231830/ext/standard/array.c:293 293 RETURN_LONG (php_count_recursive (array, mode TSRMLS_CC)); #174532 0x081420e8 in zend_do_fcall_common_helper (execute_data=0xbfffd590) at /usr/local/src/php5-200408231830/Zend/zend_execute.c:2980 2980 ((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, EX(object), return_value_used TSRMLS_CC); (gdb) frame 174533 #174533 0x0814274b in zend_do_fcall_handler (execute_data=0xbfffd590) at /usr/local/src/php5-200408231830/Zend/zend_execute.c:3114 3114 return zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); #174534 0x0813eabb in execute (op_array=0x81d0524) at /usr/local/src/php5-200408231830/Zend/zend_execute.c:1498 1498 if (EX(opline)->handler(&execute_data TSRMLS_CC)) { #174535 0x0811defe in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/local/src/php5-200408231830/Zend/zend.c:1052 1052 zend_execute(EG(active_op_array) TSRMLS_CC); ------------------------------------------------------------------------ [2004-08-23 22:10:00] jome@php.net Description: ------------ Crash on count($GLOBALS, COUNT_RECURSIVE); ./configure --disable-all --enable-cli --enable-debug --enable-memory-limit Reproduce code: --------------- <?php count($GLOBALS, COUNT_RECURSIVE); ?> Expected result: ---------------- Something similar to how var_dump() handles var_dump($GLOBALS). Actual result: -------------- Segmentation fault #0 0x08125815 in zend_hash_num_elements (ht=0x818cf30) at /usr/local/src/php5-200408231830/Zend/zend_hash.c:987 987 IS_CONSISTENT(ht); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29803&edit=1

« previous php.bugs (#91614) next »