2010/8/3 Victor Bolshov <crocodil...@gmail.com>:
> Shijiang, did you notice the
>
> --
> Warning: The magic method __call() must have public visibility and cannot be
> static in Command line code on line 1
> --
>
> ???
>
> 2010/8/3 Shijiang <shiji...@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.
>>
>
>
>
> --
> С уважением,
> Виктор
>

It was added/changed with 5.3 so it is not necessarly obvious.

Tyrael

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to