ID: 48654 Updated by: ka...@php.net Reported By: swquinn at gmail dot com -Status: Open +Status: Bogus Bug Type: Reflection related Operating System: Windows XP Professional PHP Version: 5.3CVS-2009-06-23 (snap) New Comment:
It was removed due to the removal of $this in Closures, for more information please have a look at: http://wiki.php.net/rfc/closures/removal-of-this http://wiki.php.net/rfc/closures/object-extension The code however still remains in HEAD (php6), but its still not decided whether to remove or keep it yet. Previous Comments: ------------------------------------------------------------------------ [2009-06-23 02:52:31] swquinn at gmail dot com Description: ------------ Attempting to access a closure through the ReflectionMethod's getClosure() method results in a fatal error declaring that a "... Call to undefined method ReflectionMethod::getClosure() ..." has occurred. The example below was taken from the RFC described on http://wiki.php.net/rfc/closures. I have tried this on two different Windows binaries for PHP 5.3.0 (RC3-dev and the more recent RC5-dev). NOTE: 5.3.0RC5-dev was not available for the PHP version listed, so I chose 5.3CVS-2009-06-23 (snap) as the version I tested it on (same date as the Windows binary I downloaded from http://windows.php.net/snapshots/). Reproduce code: --------------- class Example { public $x = 4; function printer () { echo "Hello World: $this->x!\n"; } } $class = new ReflectionClass ('Example'); $method = $class->getMethod ('printer'); $object = new Example; $closure = $method->getClosure ($object); $closure (); $object->x = 5; $closure (); Expected result: ---------------- Hello World: 4! Hello World: 5! Actual result: -------------- Fatal error: Call to undefined method ReflectionMethod::getClosure() ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48654&edit=1