PHP 4.0 Bug #2690: repeated operations on a character array (string) cause php to segfault (fwd)

From: Date: Tue, 09 Nov 1999 20:13:37 +0000
Subject: PHP 4.0 Bug #2690: repeated operations on a character array (string) cause php to segfault (fwd)
Groups: php.version4 
Request: Send a blank email to php-version4+get-6064@lists.php.net to get a copy of this message
libzend guys - smallest "thinkable" test-case: <? $string = "hallo"; $string[1] = 1; ?> causes: Content-Type: text/html [Tue Nov 9 21:11:29 1999] Script: '../crash/2690.php' --------------------------------------- /dot/dc4/zend/php-dev/php4_cgi_debug/../php4/libzend/zend_execute_API.c(203) : Block 0x001B0AA8 status: Beginning: Overrun (magic=0x00000000, expected=0x7312F8DC) End: Unknown --------------------------------------- [Tue Nov 9 21:11:29 1999] Script: '../crash/2690.php' --------------------------------------- /dot/dc4/zend/php-dev/php4_cgi_debug/../php4/libzend/zend_opcode.c(171) : Block 0x001B6448 status: /dot/dc4/zend/php-dev/php4_cgi_debug/../php4/libzend/zend_variables.c(62) : Actual location (location was relayed) Beginning: Cached (allocated on /dot/dc4/zend/php-dev/php4_cgi_debug/../php4/libzend/zend-scanner.l:1167, 6 bytes) End: OK --------------------------------------- Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" Digital Collections Phone +49 40 235350 Fax +49 40 23535180 Hammerbrookstr. 93 20097 Hamburg / Germany ---------- Forwarded message ---------- Date: 9 Nov 1999 19:59:32 -0000 From: jmat@firewind.net To: php-dev@lists.php.net Subject: [PHP-DEV] PHP 4.0 Bug #2690: repeated operations on a character array (string) cause php to segfault From: jmat@firewind.net Operating system: Linux PHP version: 4.0 Latest CVS (09/11/1999) PHP Bug Type: Reproduceable crash Bug description: repeated operations on a character array (string) cause php to segfault I upgraded my 11/01/99 CVS build with the RC4 build (totally starting over from scratch), and started having some very strange problems when I started manipulating strings. Basically I have a string that is used for 'flags', (i.e. position 1 has a flag of A, position 2 B, etc.). Normally, I change these flags from a webpage by recursing through an array and changing individual characters.... but suddenly it stopped working, and has started segmentation faulting ... here's a code segment of the problem code: $inarray = array(1=>"A",2=>"B",3=>"C"); // etc... $string = "A--DF--S--DS---C"; while (list($key,$val) = each($inarray)) { echo "PRE: $string<br>"; $string[$key] = $val; echo "POST: $string<p>"; } ... this works for about 2 iterations, then we have major memory munging, and $string turns into a bunch of garbage.. (even a Yen symbol or three) after 2 more iterations, the Apache child process dies. I tried doing a few different things, including converting $string to an array first, then doing a individual element replace... but then I discovered that a reset($inarray) also segfaulted things. -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.version4 (#6064) next »