[php-src] Issue #8199: Calling `static::method` from a non-static method results in a non-static call
| From: | damianwadley | Date: | Sun, 13 Mar 2022 22:26:47 +0000 |
| Subject: | [php-src] Issue #8199: Calling `static::method` from a non-static method results in a non-static call | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240329@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8199
Comment Author: damianwadley
> Essentially, I'd expect the type of method called to be determined by the operator used:
>
:: or ->
That is not how it works. :: is called the ["scope resolution
operator"](https://www.php.net/manual/en/language.oop5.paamayim-nekudotayim.php) because it
deals with scope - not decide between instanced or static access. Whether a method call is instanced
or static depends on (a) how the method is defined and (b) the scope it's being called from.
Here, that first part doesn't apply because there is no "method" method (therefore
PHP will do a dynamic call instead), however the second still does. Since the call is happening on
an instance, the method call is instanced and thus goes to __call.