From: [EMAIL PROTECTED] Operating system: Linux 2.2.20 PHP version: 4.0.6 PHP Bug Type: Arrays related Bug description: Reproductible crash (simple script) related to default variables/arrays
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 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]