Re: BC break: ReflectionMethod::invoke() expects parameter 1 to be object, string given
| From: | Pierre Joye | Date: | Mon, 22 Aug 2016 14:16:40 +0000 |
| Subject: | Re: BC break: ReflectionMethod::invoke() expects parameter 1 to be object, string given | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-95374@lists.php.net to get a copy of this message | ||
On Aug 22, 2016 9:01 PM, "Levi Morrison" <levim@php.net> wrote:
>
> 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
I have to disagree here.
Many codes out there uses string. What is the appealing reason to break
these codes in 7.1?
I think it should restore the precious behavior and if the docs need a
fix, let fix it, not the other way.
Cheers
Pierre