Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95377 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 905 invoked from network); 22 Aug 2016 14:37:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Aug 2016 14:37:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=lisachenko.it@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=lisachenko.it@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.45 as permitted sender) X-PHP-List-Original-Sender: lisachenko.it@gmail.com X-Host-Fingerprint: 209.85.215.45 mail-lf0-f45.google.com Received: from [209.85.215.45] ([209.85.215.45:35319] helo=mail-lf0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 07/60-33251-62E0BB75 for ; Mon, 22 Aug 2016 10:37:26 -0400 Received: by mail-lf0-f45.google.com with SMTP id f93so79398062lfi.2 for ; Mon, 22 Aug 2016 07:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sXOLY3sG5CdJdVBZw/IOCIxP+Cnx1IGoVv1mxhKLYo8=; b=LFRgJyBVEzSFeWLRg3TvjjShUr1x0HSsuTB/xZbqf4z7/1peelNdFZR4RKt7EUoB3l gdI7wDEaf0Gcgmk0GVcPB1oFeE591M8scFDSMVvoWN885eq1IjlaZ48uYovY7Oadf6/p 7nXHBLfsWNSvsiT+pO3GcltvxGVUOnSNJh7F2a67nkaaYpJ7T5LxpLoczjgFRyZ3YAVj z0dQ7eETIUaVx79ZxSt/Twg7/f/KsaC4wjI2b/EHNre449eMhOAKD6vOJpjQQLDjDcbT pt3PtIhiOcEedm+y4BodSjuAjDZKePervJ/7bhFaPNQPyYlLF5VShyc0D402MvaPKEQm 4G3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sXOLY3sG5CdJdVBZw/IOCIxP+Cnx1IGoVv1mxhKLYo8=; b=PfP6FE7C9PKwMAVqWuI6LD1Q6CljAVjL4Od1k1GkcQM66xdsZa566aYmt47dmlNKSR HxMO8797Ip4dAlMh2TdiMvabNe9y5zR0U51bTaOhYe43lhCHEUMD9zLJIaol/eA0BwwU sm/xcLvUcP3lutj15iHlAtDYoTjy5G+FYwRVg2YimUAuP4IVLbPQFdEJPzzrM3tH3MhN AQoR2XfflnLVkEC2WL8F7700FQtY0sZIi5jJ+YuYpA0GgoeRBhal9hqBJXTJTLqWZcZl ut6voM7DUFc3Mj2Izx5X4joteMk5+8GIzzUoTIB/5smxLTvjb5pMWO/Mc9PoQe5X2DcA w6bQ== X-Gm-Message-State: AEkoous/v15u+mw7hjmes1fdeLx1af8XckPdb+IOuukRfrYVWT8SWuxPBUFtVaL0Ss4dnTqKmfr0oMlkxjvr1A== X-Received: by 10.25.19.170 with SMTP id 42mr4827655lft.147.1471876195186; Mon, 22 Aug 2016 07:29:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.196.144 with HTTP; Mon, 22 Aug 2016 07:29:54 -0700 (PDT) In-Reply-To: References: Date: Mon, 22 Aug 2016 17:29:54 +0300 Message-ID: To: Levi Morrison Cc: Nicolas Grekas , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a114065c0c47d2c053aa9e1db Subject: Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter 1 to be object, string given From: lisachenko.it@gmail.com (Alexander Lisachenko) --001a114065c0c47d2c053aa9e1db Content-Type: text/plain; charset=UTF-8 Hello, there is one more issue with ReflectionMethod::invoke() for static methods: it's impossible to call an overridden parent static method and preserve a scope information: // https://3v4l.org/ASntq class foo { static function bar() { echo self::class, ' vs ', static::class, PHP_EOL; } static function bar1() { echo self::class, ' vs ', static::class, PHP_EOL; } } class baz extends foo { static function bar() { echo self::class, ' vs ', static::class, PHP_EOL; } } $r = new ReflectionClass('baz'); $m = $r->getMethod('bar1'); // without overriden method - it's ok, our static scope is preserved $m->invoke(null); // foo vs baz $r = new ReflectionClass('baz'); $m = $r->getMethod('bar'); // with overriden method it's impossible to call parent static method, no way to specify a scope. $m->invoke(null); // baz vs baz // how to statically call the parent static method bar() with scope == baz?? 2016-08-22 17:00 GMT+03:00 Levi Morrison : > 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 > --001a114065c0c47d2c053aa9e1db--