Bug #13476: probleme when using &$this in a constructor
| From: | e dot sobole at webshaker dot net | Date: | Fri, 28 Sep 2001 10:16:25 +0000 |
| Subject: | Bug #13476: probleme when using &$this in a constructor | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-66759@lists.php.net to get a copy of this message | ||
From: e.sobole@webshaker.net
Operating system: linux Debian 2.2
PHP version: 4.0.6
PHP Bug Type: Unknown/Other Function
Bug description: probleme when using &$this in a constructor
When I'm triing to use a reference on $this into the constructor of a
object, it's a copy of the reference which is passed.
have a look to this sample.
class A
{
var $value;
var $pB;
function A()
{
$this->Value = 100;
}
}
class B
{
var $value;
function B(&$aa)
{
$this->value = 200;
$aa->pB = &$this;
}
}
$aa = new A();
$bb = new B($aa);
$bb->value = 50;
echo var_dump($aa);
there is no 50 in the représentation of the var_dump function.
I've looked in the doc if this limitation is spécified, but NO!
Etienne
--
Edit bug report at: http://bugs.php.net/?id=13476&edit=1