php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48654 ReflectionMethod::getClosure() Undefined on Windows binary for PHP 5.3.0RC5-dev
Submitted: 2009-06-23 02:52 UTC Modified: 2009-06-23 08:20 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: swquinn at gmail dot com Assigned:
Status: Not a bug Package: Reflection related
PHP Version: 5.3CVS-2009-06-23 (snap) OS: Windows XP Professional
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: swquinn at gmail dot com
New email:
PHP Version: OS:

 

 [2009-06-23 02:52 UTC] 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()

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-23 08:20 UTC] kalle@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 02 12:01:29 2025 UTC