ReflectionClass fails on Closure class
| Bug #52057 | ReflectionClass fails on Closure class | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2010-06-11 23:08 UTC | Modified: | 2010-06-12 01:37 UTC |
|
||||||
| From: | brandon at brandonsavage dot net | Assigned: | felipe (profile) | |||||||
| Status: | Closed | Package: | Reflection related | |||||||
| PHP Version: | 5.3.2 | OS: | All | |||||||
| Private report: | No | CVE-ID: | None | |||||||
[2010-06-11 23:08 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2010-06-11 23:15 UTC] brandon at brandonsavage dot net
[2010-06-12 00:56 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: felipe
[2010-06-12 01:37 UTC] felipe@php.net
-Status: Assigned +Status: Closed
[2010-06-12 01:37 UTC] felipe@php.net