Edit report at http://bugs.php.net/bug.php?id=52057&edit=1

 ID:               52057
 Updated by:       fel...@php.net
 Reported by:      brandon at brandonsavage dot net
 Summary:          ReflectionClass fails on Closure class
-Status:           Assigned
+Status:           Closed
 Type:             Bug
 Package:          Reflection related
 Operating System: All
 PHP Version:      5.3.2
 Assigned To:      felipe

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




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

Reply via email to