Re: Inconsistencies when accessing protected members

From: Date: Wed, 26 Mar 2008 16:45:35 +0000
Subject: Re: Inconsistencies when accessing protected members
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-36541@lists.php.net to get a copy of this message
On 25/03/2008, Felipe Pena <felipensp@gmail.com> wrote: > Em Ter, 2008-03-25 às 12:35 +0100, Lars Strojny escreveu: > > > Would that mean that the following code does not work anymore? > > > > <?php > > class Foo > > { > > protected function method() > > { > > } > > > > public function doSomething(Foo $foo) > > { > > $foo->method(); > > } > > } > > > > $foo1 = new Foo(); > > $foo1->doSomething(new Foo()); > > > > > This still will works. Surely it shouldn't work at all unless the $foo === $this? I understand that the checking is based upon the class and not the instance. Shouldn't the instance be the limiting factor? Richard. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"

« previous php.internals (#36541) next »