Re: Memory corruption in Zend, should we allow this?

From: Date: Thu, 15 Mar 2001 05:17:48 +0000
Subject: Re: Memory corruption in Zend, should we allow this?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-48964@lists.php.net to get a copy of this message
I tried the following (command line): <? $foobar->rfoo=&$a; $foobar->r2foo=&$foobar->rfoo; $foobar->rfoo=4; print $a; and it didn't crash. Are you sure this reproduces a crash for you? On which platform? And any other information you can give us. Andi At 03:27 AM 3/15/2001 +0100, André Langhorst wrote:
Hi have found an interesting behaviour, watch below... 1) $foobar->rfoo=&$a; $foobar->r2foo=&$foobar->rfoo; $foobar->rfoo=4; What are we assigning 4 here to? The first question is, should we allow this? I think no, references to non-existing variables should be disallowed (although Zend allows a lot, this is no good). This is not even a reference to a variable, which could have been magically created, named ${''} or another undefined variable, let's say $b... 2) I tried to simply do a echo $a; afterwards and wow!!! It works, sometimes! Intermittently PHP crashes, without reasons, in this case I put this code below by accident
function strlens($string)    { return $string; }
ob_start('strlens'); echo '<PRE>'; var_dump($foobar); echo '</PRE>'; ob_end_flush(); I do not know what this crash relates to what made me assuming Zend randomly corrupted some memory using this undefined behaviour? If I put a die() below the echo it works in any case... +1 disallowing this or modifying behaviour that it does nothing or anything else but referencing to nirvana andré --
· André Langhorst        t: +49 331 5811560 ·
· andre@php.net          m: +49 173 9558736 ·
* PHP Quality Assurance http://qa.php.net *


« previous php.dev (#48964) next »