Hi:

2011/7/29 Etienne Kneuss <col...@php.net>:
> Hi,
>
> On Fri, Jul 29, 2011 at 05:37, Laruence <larue...@php.net> wrote:
>> Hi:
>>     about #55311.https://bugs.php.net/bug.php?id=55311
>>
>>     I found it maybe for some reason, that somebody change the
>> if/elseif sequence to make this bug.
>>
>>     but I am not sure about why he do this,  so I refer to maillist,  any 
>> idea?
>
> This is not a bug.
>
> If you call a method using the Foo::bar() syntax, you don't
> necessarily get a static call.
>
> A static call is made if either:
>
> 1) the target method is declared as static
> 2) There is no compatible object context at the time of the call.

I was wondering does this is well-documented?  since when?

obviously, it is BC break to PHP 5.3.3.

in PHP 5.3.3 __staticCall is in the front of the if/elseif statements.

so I was very interesting to know why this was changed


thanks, ;)

>
> In this case, it is not a static call, as the method is undeclared
> (hence cannot be declared as static) and you do have a compatible
> object context. So __call is used, not __callstatic.
>
> Best,
>
>>
>>    Index: Zend/zend_object_handlers.c
>> ===================================================================
>> --- Zend/zend_object_handlers.c (revision 313905)
>> +++ Zend/zend_object_handlers.c (working copy)
>> @@ -988,13 +988,13 @@
>>        if (!fbc && zend_hash_find(&ce->function_table, lc_function_name,
>> function_name_strlen+1, (void **) &fbc)==FAILURE) {
>>                efree(lc_function_name);
>>
>> -               if (ce->__call &&
>> +               if (ce->__callstatic) {
>> +                       return zend_get_user_callstatic_function(ce, 
>> function_name_strval,
>> function_name_strlen);
>> +               } else if (ce->__call &&
>>                    EG(This) &&
>>                    Z_OBJ_HT_P(EG(This))->get_class_entry &&
>>                    instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
>>                        return zend_get_user_call_function(ce, 
>> function_name_strval,
>> function_name_strlen);
>> -               } else if (ce->__callstatic) {
>> -                       return zend_get_user_callstatic_function(ce, 
>> function_name_strval,
>> function_name_strlen);
>>                } else {
>>                        return NULL;
>>                }
>> --
>> Laruence  Xinchen Hui
>> http://www.laruence.com/
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>
> --
> Etienne Kneuss
> http://www.colder.ch
>



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

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

Reply via email to