|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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: Wed Dec 06 09:01:28 2023 UTC