Re: BC break: ReflectionMethod::invoke() expects parameter 1 to be object, string given

From: Date: Mon, 22 Aug 2016 14:21:47 +0000
Subject: Re: BC break: ReflectionMethod::invoke() expects parameter 1 to be object, string given
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-95375@lists.php.net to get a copy of this message
On Mon, Aug 22, 2016 at 4:16 PM, Pierre Joye <pierre.php@gmail.com> wrote: > 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 > Hi, If it was explicitly documented to be expecting an object, then altering the code to match the documented behavior can be considered a bugfix, but I agree that if it is moderately/widely used we should consider keeping the old behavior instead of removing it in a minor version. -- Ferenc Kovács @Tyr43l - http://tyrael.hu

« previous php.internals (#95375) next »