|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-02-14 11:21 UTC] rrossi at maggioli dot it
Description:
------------
Instead of printing the desired string, PHP breaks and gives me the message in the summary (found in the apache log)
No problems with 5.2.0
my config.nice
'./configure' \
'--with-apxs' \
'--with-mysql=/usr/local/mysql' \
'--with-bz2' \
'--with-mcrypt' \
'--with-pgsql' \
'--without-pear' \
"$@"
Apache 1.3.37
Reproduce code:
---------------
header('Content-type: text/xml');
$xmlOut = "<?xml version='1.0' encoding='iso-8859-1'?>" . "<ajax-response>";
$xmlOut .= "<fragment><id>approfondimenti</id><content><![CDATA[$stApprofondimenti]]></content></fragment>" .
"<fragment><id>inevidenza</id><content><![CDATA[$stInevidenza]]></content></fragment>" .
"<fragment><id>normativa</id><content><![CDATA[$stNormativa]]></content></fragment>" .
"<fragment><id>giurisprudenza</id><content><![CDATA[$stGiurisprudenza]]></content></fragment>" .
"<fragment><id>progress</id><content><![CDATA[$stNewsMenu]]></content></fragment>" .
"<num_news>$numNews</num_news>";
$xmlOut .= "</ajax-response>";
die($xmlOut);
Expected result:
----------------
An xml stream.
Actual result:
--------------
No response from server.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 07:00:01 2025 UTC |
Fwiw, I experienced the same error with the following code and the latest PHP. ... for($i = 0; $i < $foo; $i++) { ... for($i = 0; $i < $bar; $i++) { ... } ... } ...php -v PHP 5.2.1 (cli) (built: Nov 28 2007 23:14:55) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies function crash() { $row = 1; $handle = fopen("f.csv", "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . "<br />\n"; } } fclose($handle); } f.csv has 3000 lines of "Email","Name"Hi, I have the same problem, my php version is 5.2.6: function crash() { mysql_connect( "localhost" ); } :)Hi, i too got the same issue and this is how the code works, I am having some scripts to parse the HTML data and wherein i am having part of the code as , $replaced_key = strtolower(str_replace("%", "percent", $key)); $replaced_key = str_replace(".", "", $replaced_key); $key = str_replace(" ", "_", $replaced_key); When i have the above code with the same variable name, $key = strtolower(str_ireplace("%", "percent", $key)); $key = str_ireplace(".", "", $key); $key = str_ireplace(" ", "_", $key); I get the "zend_mm_heap corrupted" error wherein when changed the code to the above way, it works fine.Sorry, I forgot to say my server runs Red Hat Linux. Um, I'm not sure if this is helpful, but I found the error when moving from PEAR:DB over to ZF DB objects. So I only changed DB code. OK, some psedudoish code: class x { function db() { $rpt = new Report(); $row = $rpt->createRow(); $row->text = 'xyz'; $row->save(); echo 'OK 2'; } } $x = new x(); echo 'OK'; $x->db(); echo 'OK 3'; And I see: OK OK 2 seg fault Also changing the function to: class x { function db() { $rpt = new Report(); $row = $rpt->createRow(); $row->text = 'xyz'; $row->save(); echo 'OK 2'; $row = null; echo 'Moooo'; } } this time it seg faults at $row = null; Hope this is of some help. It really sucks :-( JohnOK, it took me a couple of days to figure out how to do a core debug, but here is the offending gdb info: #0 0x011faba6 in zend_if_strlen (ht=1, return_value=0xb77ef1ec, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1) at /home/admin/downloads/php-5.2.6/Zend/zend_builtin_functions.c:286 286 RETVAL_LONG(Z_STRLEN_PP(str)); (gdb) bt #0 0x011faba6 in zend_if_strlen (ht=1, return_value=0xb77ef1ec, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1) at /home/admin/downloads/php-5.2.6/Zend/zend_builtin_functions.c:286 #1 0x01209ee9 in execute_internal (execute_data_ptr=0xbff61270, return_value_used=1) at /home/admin/downloads/php-5.2.6/Zend/zend_execute.c:1373 #2 0x005e31b0 in php_DBG_init_globals () from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/dbg.so-5.2.x #3 0x0120a990 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff61270) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:202 #4 0x01209fcd in execute (op_array=0xb77a99b4) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #5 0x005e312d in php_DBG_init_globals () from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/dbg.so-5.2.x #6 0x0120a219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff61730) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #7 0x01209fcd in execute (op_array=0xb77b07e8) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #8 0x005e312d in php_DBG_init_globals () from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/dbg.so-5.2.x #9 0x0120a219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff618a0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #10 0x01209fcd in execute (op_array=0xb77bc560) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #11 0x005e312d in php_DBG_init_globals () from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/dbg.so-5.2.x #12 0x0120a219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff61af0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #13 0x01209fcd in execute (op_array=0xb77da2dc) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #14 0x005e312d in php_DBG_init_globals () from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/dbg.so-5.2.x #15 0x0120a219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff61c90) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #16 0x01209fcd in execute (op_array=0xb77da62c) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #17 0x005e312d in php_DBG_init_globals () from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/dbg.so-5.2.x #18 0x0120a219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff61ee0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #19 0x01209fcd in execute (op_array=0xb77da2dc) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #20 0x005e312d in php_DBG_init_globals () from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/dbg.so-5.2.x #21 0x0120a219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff62080) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #22 0x01209fcd in execute (op_array=0xb77da62c) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #23 0x005e312d in php_DBG_init_globals () from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/dbg.so-5.2.x #24 0x0120a219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff622d0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #25 0x01209fcd in execute (op_array=0xb77da2dc) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #26 0x005e312d in php_DBG_init_globals () from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/dbg.so-5.2.x #27 0x0120a219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff62470) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #28 0x01209fcd in execute (op_array=0xb77da62c) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #29 0x005e312d in php_DBG_init_globals () from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/dbg.so-5.2.x #30 0x0120a219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff62940) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #31 0x01209fcd in execute (op_array=0xb779aa6c) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92#0 0x064a8ba6 in zend_if_strlen (ht=1, return_value=0xb7944458, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1) at /home/admin/downloads/php-5.2.6/Zend/zend_builtin_functions.c:286 #1 0x064b8821 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0af40) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:200 #2 0x064b7fcd in execute (op_array=0xb78f4044) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #3 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0b3e0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #4 0x064b7fcd in execute (op_array=0xb78ffa88) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #5 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0b530) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #6 0x064b7fcd in execute (op_array=0xb78efb98) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #7 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0b760) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #8 0x064b7fcd in execute (op_array=0xb792ef14) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #9 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0b8e0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #10 0x064b7fcd in execute (op_array=0xb792f264) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #11 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0bb10) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #12 0x064b7fcd in execute (op_array=0xb792ef14) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #13 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0bc90) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #14 0x064b7fcd in execute (op_array=0xb792f264) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #15 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0bec0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #16 0x064b7fcd in execute (op_array=0xb792ef14) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #17 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0c040) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #18 0x064b7fcd in execute (op_array=0xb792f264) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #19 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0c4f0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #20 0x064b7fcd in execute (op_array=0xb78e7810) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #21 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0c680) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #22 0x064b7fcd in execute (op_array=0xb790b140) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #23 0x064ce857 in ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER (execute_data=0xbff0c7d0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:7759 #24 0x064b7fcd in execute (op_array=0xb7b5bb40) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #25 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0c9a0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #26 0x064b7fcd in execute (op_array=0xb7adbdfc) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #27 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0cbb0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #28 0x064b7fcd in execute (op_array=0xb7b51040) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #29 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0cd40) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #30 0x064b7fcd in execute (op_array=0xb7b54314) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #31 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0ce80) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #32 0x064b7fcd in execute (op_array=0xb7b54b94) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #33 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0d010) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #34 0x064b7fcd in execute (op_array=0xb7cfe260) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #35 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0d340) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #36 0x064b7fcd in execute (op_array=0xb7a861b8) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #37 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0da80) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #38 0x064b7fcd in execute (op_array=0xb7b6960c) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #39 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0e7b0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #40 0x064b7fcd in execute (op_array=0xb7d19f04) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #41 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0eb10) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 #42 0x064b7fcd in execute (op_array=0xb7cf9f50) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 #43 0x0649e8a9 in zend_execute_scripts (type=8, retval=0xd, file_count=3) at /home/admin/downloads/php-5.2.6/Zend/zend.c:1134 #44 0x06466b01 in php_execute_script (primary_file=0xbff10dd0) at /home/admin/downloads/php-5.2.6/main/main.c:2005 #45 0x0651a3a4 in php_handler (r=0x9714788) at /home/admin/downloads/php-5.2.6/sapi/apache2handler/sapi_apache2.c:629 #46 0x00e1c9d7 in ap_run_handler () from /usr/sbin/httpd #47 0x00e1ce43 in ap_invoke_handler () from /usr/sbin/httpd #48 0x00e194f8 in ap_internal_redirect () from /usr/sbin/httpd #49 0x002e8487 in ?? () from /etc/httpd/modules/mod_rewrite.so #50 0x09714778 in ?? () #51 0x0970bdb8 in ?? () #52 0x00000000 in ?? () ######################################################## #0 0x064a8ba6 in zend_if_strlen (ht=1, return_value=0xb7944458, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1) at /home/admin/downloads/php-5.2.6/Zend/zend_builtin_functions.c:286 286 RETVAL_LONG(Z_STRLEN_PP(str)); ######################################################## (gdb) frame 2 #2 0x064b7fcd in execute (op_array=0xb78f4044) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 92 if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0) { (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name $1 = 0x661c2a3 "strlen" (gdb) frame 3 #3 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0b3e0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 234 zend_execute(EG(active_op_array) TSRMLS_CC); (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name $2 = 0x661c2a3 "strlen" (gdb) frame 4 #4 0x064b7fcd in execute (op_array=0xb78ffa88) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 92 if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0) { (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name $3 = 0x661c2a3 "strlen" (gdb) frame 5 #5 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0b530) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 234 zend_execute(EG(active_op_array) TSRMLS_CC); (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name $4 = 0x661c2a3 "strlen" (gdb) frame 6 #6 0x064b7fcd in execute (op_array=0xb78efb98) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 92 if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0) { (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name $5 = 0x661c2a3 "strlen" (gdb) frame 7 #7 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0b760) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 234 zend_execute(EG(active_op_array) TSRMLS_CC); (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name $6 = 0x661c2a3 "strlen" (gdb) frame 8 #8 0x064b7fcd in execute (op_array=0xb792ef14) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:92 92 if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0) { (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name $7 = 0x661c2a3 "strlen" (gdb) frame 9 #9 0x064b8219 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff0b8e0) at /home/admin/downloads/php-5.2.6/Zend/zend_vm_execute.h:234 234 zend_execute(EG(active_op_array) TSRMLS_CC); (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name $8 = 0x661c2a3 "strlen" ######################################################## PLEASE email me for more info if you want it, I am ***NOT*** actively watching this thread (can I RSS it??) JohnI have run into this problem too. I have not been able to make a short example script to demonstrate the problem since removing seemingly unrelated parts of code makes the problem disappear. The error is generated after the PHP script has completed. The actual problem seems to stem from calling a some static method from a class that has not yet been included. The class is included by an __autoload function. Manually including the class first seems to fix the problem, but doing random stuff in general seems to do that :) The problem occurs when returning from the function, since throwing an exception or die()-ing at that point does not show the problem. When building php with --enable-debug, the problem goes away. The problem also goes away when not using --enable-debug, but adding -DZEND_MM_HEAP_PROTECTION. Since the problem goes away when using --enable-debug, I generated the following backtraces with a modified zend_mm_panic(...) in zend_alloc.c to remove the #if ZEND_DEBUG macro. #0 0x00007f9b736d45a7 in kill () from /lib/libc.so.6 #1 0x0000000000596440 in zend_mm_panic (message=<value optimized out>) at /usr/local/src/php-5.2.8/Zend/zend_alloc.c:94 #2 0x0000000000596a45 in _zend_mm_free_int (heap=0x96f300, p=0xb) at /usr/local/src/php-5.2.8/Zend/zend_alloc.c:833 #3 0x00000000005bc298 in zend_hash_destroy (ht=0xd71040) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #4 0x00000000005cbb49 in zend_object_std_dtor (object=0xd6c570) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:45 #5 0x00000000005cbb69 in zend_objects_free_object_storage (object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122 #6 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle (handle=63) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206 #7 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xd6ffe8) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168 #8 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xd79d38) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #9 0x00000000005bc298 in zend_hash_destroy (ht=0xcf42f8) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #10 0x00000000005b12bf in _zval_dtor_func (zvalue=0xd77118) at /usr/local/src/php-5.2.8/Zend/zend_variables.c:43 #11 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xb74de0) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #12 0x00000000005bc298 in zend_hash_destroy (ht=0xd01938) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #13 0x00000000005cbb49 in zend_object_std_dtor (object=0xd6cc88) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:45 #14 0x00000000005cbb69 in zend_objects_free_object_storage (object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122 #15 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle (handle=62) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206 #16 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xd6e378) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168 #17 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xd79e70) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #18 0x00000000005bc298 in zend_hash_destroy (ht=0xd7a3d8) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #19 0x00000000005b12bf in _zval_dtor_func (zvalue=0xd7a3b0) at /usr/local/src/php-5.2.8/Zend/zend_variables.c:43 #20 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xb6e258) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #21 0x00000000005bc298 in zend_hash_destroy (ht=0xd71800) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #22 0x00000000005cbb49 in zend_object_std_dtor (object=0xd6e150) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:45 #23 0x00000000005cbb69 in zend_objects_free_object_storage (object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122 #24 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle (handle=61) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206 #25 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xd6df98) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168 #26 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xcf5db8) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #27 0x00000000005bc298 in zend_hash_destroy (ht=0xcf5bc8) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #28 0x00000000005b12bf in _zval_dtor_func (zvalue=0xcf5ba0) at /usr/local/src/php-5.2.8/Zend/zend_variables.c:43 #29 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xce8400) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #30 0x00000000005bc298 in zend_hash_destroy (ht=0xc96598) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #31 0x00000000005cbb49 in zend_object_std_dtor (object=0xccafd0) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:45 #32 0x00000000005cbb69 in zend_objects_free_object_storage (object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122 #33 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle (handle=38) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206 #34 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xcb2090) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168 #35 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xccb418) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #36 0x00000000005bc298 in zend_hash_destroy (ht=0xcccbf0) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #37 0x00000000005b12bf in _zval_dtor_func (zvalue=0xc95d00) at /usr/local/src/php-5.2.8/Zend/zend_variables.c:43 #38 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xce8c10) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #39 0x00000000005bc298 in zend_hash_destroy (ht=0xccc3c8) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #40 0x00000000005cbb49 in zend_object_std_dtor (object=0xc96e50) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:45 #41 0x00000000005cbb69 in zend_objects_free_object_storage (object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122 #42 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle (handle=36) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206 #43 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xccd2a8) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168 #44 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xcddd50) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #45 0x00000000005bc298 in zend_hash_destroy (ht=0xcccb28) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #46 0x00000000005b12bf in _zval_dtor_func (zvalue=0xcb2118) at /usr/local/src/php-5.2.8/Zend/zend_variables.c:43 #47 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xce63d0) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #48 0x00000000005bc298 in zend_hash_destroy (ht=0xccb4b8) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #49 0x00000000005cbb49 in zend_object_std_dtor (object=0xccc298) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:45 #50 0x00000000005cbb69 in zend_objects_free_object_storage (object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122 #51 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle (handle=32) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206 #52 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xcd4e28) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168 #53 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xbec940) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #54 0x00000000005bc298 in zend_hash_destroy (ht=0xc06770) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #55 0x00000000005b12bf in _zval_dtor_func (zvalue=0xcccb80) at /usr/local/src/php-5.2.8/Zend/zend_variables.c:43 #56 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xce7a90) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #57 0x00000000005bc298 in zend_hash_destroy (ht=0xccd2d0) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #58 0x00000000005cbb49 in zend_object_std_dtor (object=0xcca568) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:45 #59 0x00000000005cbb69 in zend_objects_free_object_storage (object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122 #60 0x00000000005cf1ae in zend_objects_store_del_ref_by_handle (handle=27) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:206 #61 0x00000000005cf1de in zend_objects_store_del_ref (zobject=0xcca998) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:168 #62 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xce68d0) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #63 0x00000000005bc298 in zend_hash_destroy (ht=0xcb2700) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #64 0x00000000005b12bf in _zval_dtor_func (zvalue=0xcb26d8) at /usr/local/src/php-5.2.8/Zend/zend_variables.c:43 #65 0x00000000005a4d16 in _zval_ptr_dtor (zval_ptr=0xc53520) at /usr/local/src/php-5.2.8/Zend/zend_variables.h:35 #66 0x00000000005bc298 in zend_hash_destroy (ht=0xc066b8) at /usr/local/src/php-5.2.8/Zend/zend_hash.c:526 #67 0x00000000005cbb49 in zend_object_std_dtor (object=0xc00878) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:45 #68 0x00000000005cbb69 in zend_objects_free_object_storage (object=0x25e3) at /usr/local/src/php-5.2.8/Zend/zend_objects.c:122 #69 0x00000000005ced51 in zend_objects_store_free_object_storage (objects=0x96dce0) at /usr/local/src/php-5.2.8/Zend/zend_objects_API.c:89 #70 0x00000000005a529c in shutdown_executor () at /usr/local/src/php-5.2.8/Zend/zend_execute_API.c:299 #71 0x00000000005b18e2 in zend_deactivate () at /usr/local/src/php-5.2.8/Zend/zend.c:860 #72 0x000000000057017e in php_request_shutdown (dummy=<value optimized out>) at /usr/local/src/php-5.2.8/main/main.c:1492 #73 0x000000000063596d in main (argc=1, argv=0x7fff7e8a86b8) at /usr/local/src/php-5.2.8/sapi/cgi/cgi_main.c:2052 ---- The following backtrace was generated by 'shell_exec('kill -s SEGV '.getmypid());' inside the function that causes the problem when it return's. It might be usefull #0 0x00007f55d4f458ab in fork () from /lib/libc.so.6 #1 0x00007f55d4f125ad in _IO_proc_open () from /lib/libc.so.6 #2 0x00007f55d4f12819 in popen () from /lib/libc.so.6 #3 0x0000000000518a17 in zif_shell_exec (ht=<value optimized out>, return_value=0xdaf568, return_value_ptr=<value optimized out>, this_ptr=<value optimized out>, return_value_used=<value optimized out>) at /usr/local/src/php-5.2.8/ext/standard/exec.c:462 #4 0x00000000005e0af7 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffe00af9c0) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:200 #5 0x00000000005d0923 in execute (op_array=0xdb1c00) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92 #6 0x00000000005e05b7 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffe00b0530) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:234 #7 0x00000000005d0923 in execute (op_array=0xd9b770) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92 #8 0x0000000000604b2f in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER (execute_data=0x7fffe00b0d00) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:20105 #9 0x00000000005d0923 in execute (op_array=0xb70de8) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92 #10 0x00000000005e05b7 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffe00b1230) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:234 #11 0x00000000005d0923 in execute (op_array=0xb24548) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92 #12 0x0000000000604b2f in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER (execute_data=0x7fffe00b1460) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:20105 #13 0x00000000005d0923 in execute (op_array=0xb385b8) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92 #14 0x00000000005e05b7 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffe00b1a70) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:234 #15 0x00000000005d0923 in execute (op_array=0xb37e98) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92 #16 0x00000000005e05b7 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffe00b2540) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:234 #17 0x00000000005d0923 in execute (op_array=0xb213e0) at /usr/local/src/php-5.2.8/Zend/zend_vm_execute.h:92 #18 0x00000000005b15dd in zend_execute_scripts (type=8, retval=<value optimized out>, file_count=3) at /usr/local/src/php-5.2.8/Zend/zend.c:1134 #19 0x000000000056f948 in php_execute_script (primary_file=0x7fffe00b6cc0) at /usr/local/src/php-5.2.8/main/main.c:2023 #20 0x0000000000636532 in main (argc=1, argv=0x7fffe00b6ec8) at /usr/local/src/php-5.2.8/sapi/cgi/cgi_main.c:1989 If there is anything I can to to help to resolve this issue, please ask.This script may help to reproduce the bug. It is a stupid script, but sometimes the two generated files (teste.txt, teste1.txt) are different. But they should be identical. <?php file_put_contents('teste.txt', str_repeat("ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 10000)); $output = file_get_contents('teste.txt'); for ($n=1; $n<=10000; $n++) { $output = str_replace('G', 'G', $output); } file_put_contents('teste2.txt', $output); ?>The same problem appears from a allegedly successful compilation op PHP 5.2.9 on RHEL5 64 bit using -m32 CFLAG so that the binaries are 32 bit. The compilation appears to complete successfully: Apache 2.0.59 compiled w/o any problems with the following configure and it works fine. ./configure --prefix=/apps/apache2 --with-expat=builtin PHP is configured with the following options: ./configure --with-apxs2=/apps/apache2/bin/apxs --build=i386-redhat-linux --with-pic --with-gd --with-zlib --with-config-file-path=/apps/apache2/conf --with-libdir=/lib/ --enable-debug And after the successful run, make test was run with the following errors: [Tue Mar 3 11:16:22 2009] Script: '/apps/source/php-5.2.9/run-tests.php' --------------------------------------- /apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block 0x08c71270 status: Beginning: OK (allocated on /apps/source/php-5.2.9/main/streams/plain_wrapper.c:144, 108 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0xD03365E6) At least 4 bytes overflown --------------------------------------- [Tue Mar 3 11:16:22 2009] Script: '/apps/source/php-5.2.9/run-test-info.php' --------------------------------------- /apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block 0x097cdd80 status: Beginning: OK (allocated on /apps/source/php-5.2.9/main/streams/plain_wrapper.c:160, 108 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0x512474AC) At least 4 bytes overflown --------------------------------------- [Tue Mar 3 11:16:22 2009] Script: '/apps/source/php-5.2.9/run-test-info.php' --------------------------------------- /apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block 0x097cdb78 status: Beginning: OK (allocated on /apps/source/php-5.2.9/main/streams/plain_wrapper.c:160, 108 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0x512474AC) At least 4 bytes overflown --------------------------------------- [Tue Mar 3 11:16:22 2009] Script: '/apps/source/php-5.2.9/run-test-info.php' --------------------------------------- /apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block 0x097cd9ac status: Beginning: OK (allocated on /apps/source/php-5.2.9/main/streams/plain_wrapper.c:160, 108 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0x512474AC) At least 4 bytes overflown --------------------------------------- [Tue Mar 3 11:16:22 2009] Script: '/apps/source/php-5.2.9/run-test-info.php' /apps/source/php-5.2.9/main/streams/plain_wrapper.c(160) : Freeing 0x097CD9AC (108 bytes), script=/apps/source/php-5.2.9/run-test-info .php /apps/source/php-5.2.9/ext/standard/php_fopen_wrapper.c(312) : Actual location (location was relayed) Last leak repeated 2 times === Total 3 memory leaks detected === [Tue Mar 3 11:16:22 2009] Script: '/apps/source/php-5.2.9/run-tests.php' --------------------------------------- /apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block 0x08c734c4 status: Beginning: OK (allocated on /apps/source/php-5.2.9/main/streams/plain_wrapper.c:292, 108 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0xD03365E6) At least 4 bytes overflown --------------------------------------- [Tue Mar 3 11:16:22 2009] Script: '-' --------------------------------------- /apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block 0x086d7038 status: Beginning: OK (allocated on /apps/source/php-5.2.9/main/streams/plain_wrapper.c:160, 108 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0x4C780131) At least 4 bytes overflown --------------------------------------- [Tue Mar 3 11:16:22 2009] Script: '-' --------------------------------------- /apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block 0x086d6e30 status: Beginning: OK (allocated on /apps/source/php-5.2.9/main/streams/plain_wrapper.c:160, 108 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0x4C780131) At least 4 bytes overflown --------------------------------------- [Tue Mar 3 11:16:22 2009] Script: '-' --------------------------------------- /apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block 0x086d6c64 status: Beginning: OK (allocated on /apps/source/php-5.2.9/main/streams/plain_wrapper.c:160, 108 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0x4C780131) At least 4 bytes overflown --------------------------------------- [Tue Mar 3 11:16:22 2009] Script: '-' /apps/source/php-5.2.9/main/streams/plain_wrapper.c(160) : Freeing 0x086D6C64 (108 bytes), script=- /apps/source/php-5.2.9/ext/standard/php_fopen_wrapper.c(312) : Actual location (location was relayed) Last leak repeated 2 times === Total 3 memory leaks detected === [Tue Mar 3 11:16:22 2009] Script: '/apps/source/php-5.2.9/run-tests.php' --------------------------------------- /apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block 0x08c73f44 status: Beginning: OK (allocated on /apps/source/php-5.2.9/main/streams/plain_wrapper.c:292, 108 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0xD03365E6) At least 4 bytes overflown --------------------------------------- zend_mm_heap corrupted /bin/sh: line 23: 32041 Segmentation fault TEST_PHP_EXECUTABLE=/apps/source/php-5.2.9/sapi/cli/php TEST_PHP_SRCDIR=/apps/source/ph p-5.2.9 CC="gcc" /apps/source/php-5.2.9/sapi/cli/php -n -c /apps/source/php-5.2.9/tmp-php.ini -d 'open_basedir=' -d 'output_buffering=0 ' -d 'memory_limit=-1' /apps/source/php-5.2.9/run-tests.php -n -c /apps/source/php-5.2.9/tmp-php.ini -d extension_dir=/apps/ source/php-5.2.9/modules/ ` if test "x" != "x"; then for i in ""; do . $i; /apps/source/php-5.2.9/build/shtool echo -n -- " -d extension=$dlname"; done; fi; if test "x" != "x"; then for i in ""; do . $i; /apps/source/php-5.2.9/build/shtool echo -n -- " -d zend_extension_debug=/app s/source/php-5.2.9/modules/$dlname"; done; fi` make: [test] Error 139 (ignored) I think this is because the configure script assesses the intmax_t as 4 as opposed to 8 and all of the integers are overflowing with 4 bytes. Just a guess but comparing to an other environment where I managed to compile it successfully, these appear to be the main differences in config.log.Hi , I have tested with the version 5.3 of PHP with no success. I have this error: Fatal error: Out of memory (allocated 564920320) (tried to allocate 39063398 bytes) in I:\srvDevPHP\PHP_PEAR\File\PDF.php on line 3191 zend_mm_heap corrupted The line 3191 is << $this->_buffer .= $s . "\n"; >> of the _out function. How can i use the USE_ZEND_ALLOC parameter. I don't find any file for do that. Somme info: EasyPhp 2.0.0.0 php 5.3.0 Apache 2.2.13 Thanks KarimHi all, in answer to sriram above, here we go: -bash-3.00$ /usr/local/apache2/bin/httpd -V Server version: Apache/2.2.13 (Unix) Server built: Oct 5 2009 10:20:45 Server's Module Magic Number: 20051115:23 Server loaded: APR 1.3.8, APR-Util 1.3.9 Compiled using: APR 1.3.8, APR-Util 1.3.9 Architecture: 64-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT="/usr/local/apache2" -D SUEXEC_BIN="/usr/local/apache2/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" So it is prefork. If ZTS is enabled with --enable-maintainer-zts, then it?s off. Also, from phpinfo(), Debug Build no Thread Safety disabled Zend Memory Manager enabled and it seems USE_ZEND_ALLOC=0 does nothing for me. I?m on CentOS 4.6 on multi-core AMD64, with nearly 1GB RAM and a very busy server. There are plenty of custom systems in this machine, so I can?t tell what is causing it, but it started after we began using Elxis 2009.0 in production state (about 15 hits/second). My configure lines includes a lot of other parameters, like oci and MySQLi, but if of any use, I?ll compare the relevant items with rrossi?s (bug opener) config.nice: './configure' \ '--with-apxs' \ # idem '--with-mysql=/usr/local/mysql' \ #'--with-mysql=/usr' (CentOS rpm) '--with-bz2' \ # no '--with-mcrypt' \ #no '--with-pgsql' \ #no '--without-pear' \ # --with-pear Apache also includes a lot of modules. The most relevant, I guess, are rewrite, proxy (http & ajp), ssl, and cache. If any other info needed, feel free (and please) contact me. It?s been a serious problem down here.Just for history/logging purposes, I got this same error on PHP 5.2.6 + MySQL 5.1 + Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.7a DAV/2 + SuPHP on RHEL 4 today. It was related to mysql_* calls, phpinfo() worked fine, no errors. Any mysql_* call crashed. Code: --------------- [eromero@roll tmp]$ cat /tmp/test.php <?php echo "Hola"; $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); Reproducing --------------- [eromero@roll tmp]$ /usr/local/php5-cgi/bin/php-cgi /tmp/test.php zend_mm_heap corrupted Worked fine with USE_ZEND_ALLOC=0 --------------- [eromero@roll tmp]$ export USE_ZEND_ALLOC=0 [eromero@roll tmp]$ /usr/local/php5-cgi/bin/php-cgi /tmp/test.php PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql- connect</a>]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /tmp/test.php on line 2 X-Powered-By: PHP/5.2.6 Content-type: text/html HolaCould not connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) Updating to 5.3.2 fixed the issue. Here's the config line I used in BOTH 5.2.6 and 5.3.2, everything compiled fine both times. Disregard the unused flags: './configure' \ '--prefix=/usr/local/php5-cgi' \ '--with-curl' \ '--with-freetype-dir=/usr' \ '--with-png-dir=/usr' \ '--enable-gd-native-ttf' \ '--with-jpeg-dir=/usr' \ '--with-png' \ '--enable-magic-quotes' \ '--enable-sockets' \ '--enable-sysvsem' \ '--enable-sysvshm' \ '--enable-sysvmsg' \ '--enable-track-vars' \ '--enable-trans-sid' \ '--enable-yp' \ '--enable-wddx' \ '--with-pear=/usr/share/pear' \ '--with-kerberos' \ '--with-mysql=/usr/local/mysql' \ '--with-mysqli' \ '--with-pcre-regex' \ '--disable-cli' \ '--enable-cgi' \ '--enable-mbstring' \ '--enable-fastcgi' \ '--enable-force-cgi-redirect' \ '--enable-discard-path' \ '--with-oci8=instantclient,/usr/lib/oracle/11.1.0.1/client/lib' \ '--with-gd' \ '--with-zlib' Cheers, Eduardo Romero http://foxteck.orgThe cause is pretty clear to me: when the script ends, the garbage collector starts to destroy the objects and the `unset()` in the destructor probably invokes the garbage collector again. The error message doesn't always appear on the screen nor in the error log (sometimes it does). The "Segmentation fault" always appears in the error log. Breaks if PHP is installed using apt-get or yum or comes with your Linux distro. Seems to work fine on Windows and codepads (custom compiled PHPs). Definitely breaks on Debian. Don't forget to set memory_limit to have enough room in memory to create all the objects (128M seems to be enough on Debian to create 150,000 objects). <?php define('OBJECT_COUNT', 20 * 1000); class Object { private static $world = array(); private static $maxGuid = 0; protected $_guid = null; public function __construct() { self::$world[$this->_guid = self::$maxGuid++] = $this; } public function __destruct() { unset(self::$world[$this->_guid]); } } for ($i = 0; $i < OBJECT_COUNT; ++$i) { new Object(); } // You probably won't see this because of the "zend_mm_heap corrupted" echo 'If you see this, try to increase OBJECT_COUNT to 100,000'; ?> If this code pinpoints the four and a half years-old issue, email me a beer. Florin ArdelianSecond this by running code, provided by "f dot ardelian at gmail dot com" at 2011-08-31 07:49 UTC: # php -q zend_mm_heap_corrupted.php If you see this, try to increase OBJECT_COUNT to 100,000zend_mm_heap corrupted # php --version PHP 5.3.8 (cli) (built: Aug 29 2011 14:48:33) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick RethansI can reproduce the bug on Microsoft Windows XP SP3, with latest official PHP 5.3.8 NTS build. When we run script from "f dot ardelian at gmail dot com", PHP does not output "zend_mm_heap corrupted", but right after displaying the "If you see this…" line CRASHES. However, I found that when I call "gc_disable();" before script end, it finishes successfully. This helped me run the test script without problems, but didn't solve the issue in my other scripts. <? define('OBJECT_COUNT', 100 * 1000 * 10); class Object { private static $world = array(); private static $maxGuid = 0; protected $_guid = null; public function __construct() { self::$world[$this->_guid = self::$maxGuid++] = $this; } public function __destruct() { unset(self::$world[$this->_guid]); } } for ($i = 0; $i < OBJECT_COUNT; ++$i) { new Object(); } // You probably won't see this because of the "zend_mm_heap corrupted" echo 'If you see this, try to increase OBJECT_COUNT to 100,000'; gc_disable(); // ADDED - works for me - PHP does not crash ?>