Re: Bug #14374 Updated: Reproductible crash (simple script) related to default variables/arrays
| From: | Jani Taskinen | Date: | Fri, 07 Dec 2001 22:03:36 +0000 |
| Subject: | Re: Bug #14374 Updated: Reproductible crash (simple script) related to default variables/arrays | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-72900@lists.php.net to get a copy of this message | ||
I saw the other reports he referred to are open?
Did you check those?
--Jani
On 7 Dec 2001 derick@php.net wrote:
>ID: 14374
>Updated by: derick
>Reported By: xroche@free.fr
>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] xroche@free.fr
>
>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
>
>
>