PHP 5.0.3 losing $this - followup.
| From: | Yermo Lamers | Date: | Sun, 06 Mar 2005 02:01:33 +0000 |
| Subject: | PHP 5.0.3 losing $this - followup. | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-15262@lists.php.net to get a copy of this message | ||
Thanks to michaels (at) crye-leike.com for the followup. He produced a
much shorter version of the code that produces the same result:
<?php
class Foo {
function &getThis() {
return( $this );
}
function destroyThis() {
$baz =& $this->getThis();
}
}
$bar = new Foo();
$bar->destroyThis();
var_dump($bar);
?>
Interestingly if you change the return( $this ) in &getThis() to return
$this; the bug is reproduced. Weird, parentheses making the difference.
I had thought it was related to the depth of subclasses and the particular
arrangement of members; i.e. classic buffer overrun symptoms.
So I stand corrected.
As a followup question, if I have a large body of code for which I cannot
produce a small test case what's the recommended approach to tracking it
down .. pass it by here before posting the bug report? I've still got that
weird PHP 4.3.10 bug that should also get resolved.
----------------------------------------------------------------------------
DTLink Software http://www.dtlink.com
Desktop Software and Web Applications
----------------------------------------------------------------------------