ID:               19738
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Duplicate
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Linux, Windows
 PHP Version:      4.2.3


Previous Comments:
------------------------------------------------------------------------

[2002-10-27 19:51:19] [EMAIL PROTECTED]

this due to that whole shallow copy thingy... ;-)

------------------------------------------------------------------------

[2002-10-03 10:15:34] [EMAIL PROTECTED]

Normally this code should print "0", 
however, when uncommenting a single empty method call, 
it outputs "1".
It seems like a copy suddenly becomes a reference.

<?php

$a1 = new A();
//$a1->c->f();  // uncomment this to expose error.
$a2 = $a1;
$a2->c->x = 1;
echo $a1->c->x;

class C {
    var $x = 0;
    function f() {}
}

class A {
    var $c;
    function A() { $this->c = new C(); }
}

?>

Thanks. 
Anahoret Team.

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=19738&edit=1

Reply via email to