Re: BC break: ReflectionMethod::invoke() expects parameter 1 to be object, string given
| From: | Julien Pauli | Date: | Mon, 22 Aug 2016 16:00:18 +0000 |
| Subject: | Re: BC break: ReflectionMethod::invoke() expects parameter 1 to be object, string given | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-95384@lists.php.net to get a copy of this message | ||
I agree this is a BC break and should not stay as-is in source code.
It makes some testsuites fail, that did not fail before ; thus it breaks things.
I think @Alexander is right.
We should allow passing a string, and perform some Late Static Binding
through it.
That would solve the BC Break problem as well as extend the feature in
a more PHP-friendly way.
Julien
On Mon, Aug 22, 2016 at 5:55 PM, Alexander Lisachenko
<lisachenko.it@gmail.com> wrote:
> First argument can be a normal string with a valid scope class name for
> static methods. This can be useful for calling parent static methods, see
> my example.
>
> I think this will be comparable with Closure::call() method and scope
> binding.
>
> понедельник, 22 августа 2016 г. пользователь Rowan Collins
> написал:
>
>> On 22/08/2016 16:40, Christoph M. Becker wrote:
>>
>>> It is still ignored if it is a valid object, so the current beta's
>>>> > behaviour doesn't actually make a lot of sense.
>>>>
>>> Well, see <https://3v4l.org/n8cad>. Only as of
>>> 7.1.0beta3 ::invoke()
>>> matches the behavior of ::invokeArgs().
>>>
>>
>> OK, so that's a further inconsistency. The current version still doesn't
>> actually make sense, though. If you want to validate that the correct
>> argument is being passed, then the only value allowed should be null.
>>
>> If so desired, I can revert that commit, but I wouldn't be happy with
>>> sticking with a completely unused parameter, which obviously has been
>>> and still is misunderstood.
>>>
>>
>> The parameter is still unused, and can be any object. The only sane
>> validation would be to check explicitly for null, which is documented as
>> the correct argument for both invoke() and invokeArgs().
>>
>> Regards,
>> --
>> Rowan Collins
>> [IMSoP]
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>