Re: $ref =& $this;
| From: | Rasmus Lerdorf | Date: | Mon, 03 Oct 2005 15:11:30 +0000 |
| Subject: | Re: $ref =& $this; | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-19355@lists.php.net to get a copy of this message | ||
Andi Gutmans wrote:
> Assigning to it will break "this" in the symbol table, or EG(This)? If
> it's the latter then it is a problem (and it's the reason I didn't
> support it to begin with).
Given that:
class foo {
function bar() {
$this->a = 1;
$ref = &$this;
$ref->b = 2;
$ref = null;
}
}
$x = new foo;
$x->bar();
echo $x->a, $x->b;
Outputs 12 and doesn't appear to cause any major badness internally, I
don't really see any reason to disallow it. If an E_STRICT could be
raised without affecting performance too much that would be good since
it is a useless assignment. Given the lack of badness on the php5 side
and the high level of goodness for php4 portability, I say leave it as
it is now.
-Rasmus