On 22/08/2016 12:17, Nicolas Grekas wrote:
in ReflectionMethod::invoke():

the method doesn't accept a string as first argument anymore, see e.g.:

https://3v4l.org/pImmv

To be precise, in prior versions, the first argument was completely ignored for static methods: https://3v4l.org/8o4Hm

$m->invoke('some_other_class_name', 'baz'); // Warns in 7.1.0beta3, ignores everywhere else
$m->invoke(42, 'baz'); // Warns in 7.1.0beta3, ignores everywhere else
$m->invoke(new DateTime, 'baz'); // OK in all versions
$m->invoke($m, 'baz'); // OK in all versions

It is still ignored if it is a valid object, so the current beta's behaviour doesn't actually make a lot of sense. The most logical would be for it to fail on any value other than null, since for a non-static method any other object will give "Given object is not an instance of the class this method was declared in" (except in HHVM, which just invokes on whatever object you give it): https://3v4l.org/sCFcA

However, simply documenting that "the first argument is ignored for static methods", and removing the parameter validation, would probably be sensible for BC if there is likely to be real-world code passing something other than null.

Regards,
--
Rowan Collins
[IMSoP]

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

Reply via email to