php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45608 closures don't work in static methods
Submitted: 2008-07-23 18:18 UTC Modified: 2008-07-26 14:16 UTC
From: php at benjaminschulz dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2008-07-23 (CVS) OS: *
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: php at benjaminschulz dot com
New email:
PHP Version: OS:

 

 [2008-07-23 18:18 UTC] php at benjaminschulz dot com
Description:
------------
If a closure is declared in a statically called method it cannot be 
executed.

Reproduce code:
---------------
--TEST--
Closure 023: Closure declared in statically called method
--FILE--
<?php
class foo {
    public static function bar() {
        $func = function() { echo "Done"; };
        $func();
    }
}
foo::bar();
?>
--EXPECTF--
Done



Actual result:
--------------
Non-static method foo::() cannot be called statically in ...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-26 14:16 UTC] dmitry@php.net
This bug has been fixed in CVS.

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.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Apr 29 10:01:29 2025 UTC