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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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 09:01:29 2025 UTC