ID: 43229 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Verified Bug Type: Scripting Engine problem Operating System: CentOS PHP Version: 5.2CVS-2007-11-09 (CVS) New Comment:
I get the same crash regardless what the variable name is: Program received signal SIGSEGV, Segmentation fault. 0x08305dea in zend_hash_get_current_data_ex (ht=0x928721c, pData=0xbff8e0fc, pos=0xbff8e0e4) at /home/jani/src/php-5.3/Zend/zend_hash.c:1163 1163 *pData = p->pData; (gdb) bt #0 0x08305dea in zend_hash_get_current_data_ex (ht=0x928721c, pData=0xbff8e0fc, pos=0xbff8e0e4) at /home/jani/src/php-5.3/Zend/zend_hash.c:1163 #1 0x082015df in php_array_walk (target_hash=0x928721c, userdata=0x0, recursive=0) at /home/jani/src/php-5.3/ext/standard/array.c:1035 #2 0x08201834 in zif_array_walk (ht=2, return_value=0x9287a18, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0) at /home/jani/src/php-5.3/ext/standard/array.c:1126 #3 0x0831f002 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff8e3bc) at /home/jani/src/php-5.3/Zend/zend_vm_execute.h:194 #4 0x08324824 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0xbff8e3bc) at /home/jani/src/php-5.3/Zend/zend_vm_execute.h:1439 #5 0x0831eb06 in execute (op_array=0x9285f10) at /home/jani/src/php-5.3/Zend/zend_vm_execute.h:87 #6 0x082f7a7e in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/jani/src/php-5.3/Zend/zend.c:1139 #7 0x0829ff95 in php_execute_script (primary_file=0xbff90740) at /home/jani/src/php-5.3/main/main.c:2007 #8 0x0837f5c4 in main (argc=2, argv=0xbff90894) at /home/jani/src/php-5.3/sapi/cli/php_cli.c:1140 Previous Comments: ------------------------------------------------------------------------ [2007-11-10 00:05:05] [EMAIL PROTECTED] if you use a different var name like $tmpkeyword instead of $thiskeyword - it works... ;) ------------------------------------------------------------------------ [2007-11-09 23:07:02] [EMAIL PROTECTED] Looks like a problem happens because array is modified while array_walk is walking it. ------------------------------------------------------------------------ [2007-11-09 20:45:28] [EMAIL PROTECTED] Description: ------------ strace doesnt output anything - it just cuts the output with a segfault. if you change the variable from $thiskeyword to something else without "this" at the start, it works correctly... ;) Reproduce code: --------------- <?php $stopwords = array( 'this', 'a', 'the', 'is' ); $keyword = explode( ' ', 'this is a big problem' ); for( $i = 0; $i < 1000; $i++ ) { $thiskeyword = $keyword; array_walk( $thiskeyword, create_function('$v,$k','global $thiskeyword,$stopwords;if(in_array($v,$stopwords)){unset($thiskeyword[$k]);}')); } ?> Actual result: -------------- Segmentation Fault ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43229&edit=1