Bug #52057 [Opn->Asn]: ReflectionClass fails on Closure class
| From: | felipe@php.net | Date: | Fri, 11 Jun 2010 22:56:17 +0000 |
| Subject: | Bug #52057 [Opn->Asn]: ReflectionClass fails on Closure class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-151357@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52057&edit=1
ID: 52057
Updated by: felipe@php.net
Reported by: brandon at brandonsavage dot net
Summary: ReflectionClass fails on Closure class
-Status: Open
+Status: Assigned
Type: Bug
Package: Reflection related
Operating System: All
PHP Version: 5.3.2
-Assigned To:
+Assigned To: felipe
Previous Comments:
------------------------------------------------------------------------
[2010-06-11 23:15:00] brandon at brandonsavage dot net
I forgot to mention that method_exists() correctly identifies the
presence of __invoke() in the Closure class instance.
------------------------------------------------------------------------
[2010-06-11 23:08:24] brandon at brandonsavage dot net
Description:
------------
According to the documentation, the Closure class implements
__construct() and __invoke(). However, when ReflectionClass::hasMethod()
and ReflectionClass::getMethods() are run against a closure, they do not
report the existence of the __invoke() method. On user-defined classes,
the existence of __invoke() is reported if __invoke() is defined.
Test script:
---------------
$closure = function($a) { echo $a; };
$reflection = new ReflectionClass($closure);
var_dump($reflection->hasMethod('__invoke()');
Expected result:
----------------
boolean true
Actual result:
--------------
boolean false
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52057&edit=1