Re: object refrences (POSSIBLE MAJOR BUG)

From: Date: Thu, 11 Apr 2002 16:52:36 +0000
Subject: Re: object refrences (POSSIBLE MAJOR BUG)
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-82592@lists.php.net to get a copy of this message
--- Andrey Hristov <ahristov@icygen.com> wrote: > I receive this: > object(foo)(1) { > ["bar"]=> > &object(bar)(1) { > ["tmp"]=> > string(23) "why does this add a ref" > } > } > > As far as I can see, there is an reference. exacly ... why? cause im doing stuff where i expect that to be a copy... > > Andrey > ----- Original Message ----- > From: "brad lafountain" <rodif_bl@yahoo.com> > To: <php-dev@lists.php.net> > Sent: Thursday, April 11, 2002 7:37 PM > Subject: [PHP-DEV] object refrences (POSSIBLE MAJOR BUG) > > > > After a full day of looking into a bug on a script i have i found this > problem. > > > > basically if you invoke a method from a member object it adds a ref instead > of > > keeping it 'non ref'. > > > > Is this by design or is it a bug. > > > > <? > > class foo > > { > > var $bar; > > function foo() > > { > > $this->bar = new bar("inside foo"); > > $this->bar->set_tmp("why does this add a ref"); > > > > /* > > // this works fine > > $bar = new bar("inside foo"); > > $bar->set_tmp("no ref"); > > $this->bar = $bar; > > */ > > > > /* > > file://this doesn't work > > $bar = new bar("inside foo"); > > $this->bar = $bar; > > $this->bar->set_tmp("why does this add a ref"); > > */ > > } > > } > > > > class bar > > { > > var $tmp; > > > > function bar($tmp) > > { > > $this->tmp = $tmp; > > } > > > > function set_tmp($tmp) > > { > > $this->tmp = $tmp; > > } > > } > > > > var_dump(new foo()); > > > > ?> > > > > - Brad > > > > > > __________________________________________________ > > Do You Yahoo!? > > Yahoo! Tax Center - online filing with TurboTax > > http://taxes.yahoo.com/ > > > > -- > > PHP Development Mailing List <http://www.php.net/> > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/

« previous php.dev (#82592) next »