From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      4.0.6
PHP Bug Type:     Class/Object related
Bug description:  Problems with classes and links to objects

<?
phpinfo();
class a {
        
        function a ($obj) {
                $this->h = &$obj;
                return true;
        }
}

class b {
        var $d=1;
        var $item;
        
        function b () {
                $this->item = new a (&$this);
                $this->d++;
                echo $this->d.'//'.$this->item->h->d.'<br>';    }
        
        function c () {
                $this->item = new a (&$this);
        }
}

$b = new b ();
//$b->c (); //****
$b->d++;
echo $b->d.'--'.$b->item->h->d;


/*
Try to comment and recomment line ****
I see there is a bug with that sitution:
after finishing of object "b" constructor, link $a->h not linked to "b"
object and $a->h is a copy of object "b".
I think, this is not right. In constructor $a->h is still link to "b", but
after finishing the $a->h is a copy of "b".
*/
-- 
Edit bug report at: http://bugs.php.net/?id=12365&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to