Re: BC break: ReflectionMethod::invoke() expects parameter 1 to be object, string given
| From: | Levi Morrison | Date: | Mon, 22 Aug 2016 14:00:36 +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-95373@lists.php.net to get a copy of this message | ||
On Mon, Aug 22, 2016 at 5:17 AM, Nicolas Grekas <
nicolas.grekas+php@gmail.com> wrote:
> Hello,
>
> now that the BC break on ReflectionType has been reverted, another one
> remains in ReflectionMethod::invoke():
>
> the method doesn't accept a string as first argument anymore, see e.g.:
>
> https://3v4l.org/pImmv
>
> As you can see, this worked since 5.0 and even in HHVM.
>
> It would be great to fix this BC break please.
>
> Regards,
> Nicolas
>
According to the [documentation][1] it requires an object. If the
documentation has not been altered recently to make it this way then I'm
inclined to keep the backward compatibility break. Your example uses a
static method - you should be passing null and not the name of the class
(this is also in the documentation).
[1]: http://php.net/manual/en/reflectionmethod.invoke.php