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

From: Date: Mon, 22 Aug 2016 15:40:41 +0000
Subject: Re: BC break: ReflectionMethod::invoke() expects parameter1 to be object, string given
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-95380@lists.php.net to get a copy of this message
On 22.08.2016 at 16:38, Rowan Collins wrote: > 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. Well, see <https://3v4l.org/n8cad>. Only as of 7.1.0beta3 ::invoke() matches the behavior of ::invokeArgs(). -- Christoph M. Becker

« previous php.internals (#95380) next »