Bug #75186 [Asn->Csd]: Inconsistent reflection of Closure:::__invoke()
| From: | nikic@php.net | Date: | Thu, 09 May 2019 10:36:45 +0000 |
| Subject: | Bug #75186 [Asn->Csd]: Inconsistent reflection of Closure:::__invoke() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220795@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75186&edit=1
ID: 75186
Updated by: nikic@php.net
Reported by: kontakt at kukulich dot cz
Summary: Inconsistent reflection of Closure:::__invoke()
-Status: Assigned
+Status: Closed
Type: Bug
Package: Reflection related
PHP Version: Irrelevant
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=35c80583f08c0af3d01715cb8feeca6d0f284545
Log: Fixed bug #75186
Previous Comments:
------------------------------------------------------------------------
[2018-10-02 16:49:15] nikic@php.net
It looks like we have a bunch of special-casing for Closure::__invoke, but getMethods() in
particular only uses it if the reflection is on an object rather than class.
------------------------------------------------------------------------
[2018-02-28 20:08:19] carusogabriel34 at gmail dot com
From the documentation:
> Besides the methods listed here, this class also has an __invoke method. This is for
> consistency with other classes that implement calling magic, as this method is not used for calling
> the function.
So I believe is the expected behavior.
------------------------------------------------------------------------
[2018-02-07 20:24:02] kontakt at kukulich dot cz
See the test in the description.
------------------------------------------------------------------------
[2018-02-07 16:02:15] carusogabriel34 at gmail dot com
Could not reproduced https://3v4l.org/mGJjd
------------------------------------------------------------------------
[2017-09-11 12:37:00] kontakt at kukulich dot cz
Description:
------------
https://3v4l.org/QBIvb
Test script:
---------------
<?php
$rc = new ReflectionClass(Closure::class);
$methodNames = array_map(function ($m) {
return $m->getName();
}, $rc->getMethods());
var_dump(in_array('__invoke', $methodNames));
var_dump($rc->hasMethod('__invoke'));
Expected result:
----------------
bool(true)
bool(true)
Actual result:
--------------
bool(false)
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75186&edit=1