|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70159 __CLASS__ is lost in closures declared in classes
Submitted: 2015-07-28 14:28 UTC Modified: 2015-07-28 16:15 UTC
From: Assigned: bwoebi (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0.0beta2 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
39 - 32 = ?
Subscribe to this entry?

 [2015-07-28 14:28 UTC]
If a closure is declared into a class, using __CLASS__ into this closure returns empty string

Test script:
class Foo
    public function bar() {
        return function () { var_dump(__CLASS__); };

(new Foo)->bar()();

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-28 14:31 UTC]
-Status: Open +Status: Feedback
 [2015-07-28 14:31 UTC]
Please try using this snapshot:
For Windows:

Fixed. Will be part of PHP7.0beta3
 [2015-07-28 16:15 UTC]
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: bwoebi
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Dec 06 08:01:31 2023 UTC