Memory corruption in Zend, should we allow this?
| From: | André Langhorst | Date: | Thu, 15 Mar 2001 02:27:02 +0000 |
| Subject: | Memory corruption in Zend, should we allow this? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-48960@lists.php.net to get a copy of this message | ||
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 *