Re: Confusing performance of the magic method __call

From: Date: Tue, 03 Aug 2010 11:14:37 +0000
Subject: Re: Confusing performance of the magic method __call
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-49194@lists.php.net to get a copy of this message
2010/8/3 Shijiang <shijiang@staff.sina.com.cn>: > Hi, > > In the following sample code, I expected that the magic method __call only works within the > class Test. > But it seems that the access control keyword private lost its efficacy when working together > with the magic method __call. > > <?php > class Test{ >    private function __call($name,$params){ >        echo $name,"\n"; >        echo $params[0]; >    } > >    public function bar(){ >        $this->kakaka('afaafaf'); >    } > } > $foo=new Test; > $foo->bar('sfsfss'); > $foo->nothing('works'); // this also works without any errors. > ?> > > IMHO, since the function __call is a method of a class, it should obey the visibility rules. > > Cheers. > http://www.php.net/manual/en/migration53.incompatible.php The magic methods __get, __set, __isset, __unset, and __call must always be public and can no longer be static. Method signatures are now enforced. Tyrael

« previous php.internals (#49194) next »