|  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [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: Fri Dec 01 14:01:29 2023 UTC