ID: 14374 Updated by: derick Reported By: [EMAIL PROTECTED] Old Status: Open Status: Closed Bug Type: Arrays related Operating System: Linux 2.2.20 PHP Version: 4.0.6 New Comment:
I can not reproduce this with php 4.1.0RC5 or php 4.2.0dev, so considered fixed. (You can try yourself with www.php.net/~zeev/php-4.1.0RC5.tar.gz) PHP 4.1.0 will be released in a few days now. Derick Previous Comments: ------------------------------------------------------------------------ [2001-12-07 06:09:05] [EMAIL PROTECTED] This following simple script will crash both PHP 4.06 (module and cgi) and previous 4.05 but NOT 4.03pl1 (?!), and might be related to the following bug ID's: Bug id #12776 Bug id #14281 It seems that there's a problem between array variables, default values and empty arrays accessed through index (a null variable used as array using an index) If you change the code and delete the first foo variable (in function and in the call), this won't crash (!) I am still trying to simplify this code to find an immediate and obvious cause for the core dump, but IMHO this script is yet simple enough to detect a problem. <pre> <?php // will work without first dummy parameter Function FooBar($foo,$depth=10,$bar=array()) { if ($depth<0) return ""; // echo .. echo "in FooBar (".$depth.")\n"; // This part will cause damages soon return FooBar($foo,$depth-1,$bar) . FooBar2("",$bar) . $foo["foo_bar"][13345879]; } // will work without first dummy parameter Function FooBar2($foo,$bar=array()) { // This part shall seg fault .. if (!$bar["foo_bar"]) { $bar["foo_bar"]=$bar["foo_bar"]+1; } // echo .. echo "in FooBar2 (".$foo.")\n"; // This part will cause memory damages.. $if_I_do_that_this_will_crash=serialize($bar); return ""; } FooBar(""); ?> </pre> ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=14374&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]