php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53554 about $this
Submitted: 2010-12-16 11:33 UTC Modified: 2010-12-16 11:49 UTC
From: smallslime at gmail dot com Assigned:
Status: Duplicate Package: Class/Object related
PHP Version: 5.3.4 OS: linux
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:
MUST BE VALID
Solve the problem:
16 + 36 = ?
Subscribe to this entry?

 
 [2010-12-16 11:33 UTC] smallslime at gmail dot com
Description:
------------
why section 1 is error and section 2 is correct?

Test script:
---------------
section 1:
class p {
    public function a() {
        echo '123<hr>';
        $p = 'this';
        return $$p;
    }
}
$c = new p();
$c->a();

section 2:
class p {
    public function a() {
        echo '123<hr>';
        $this;
        $p = 'this';
        return $$p;
    }
}
$c = new p();
$c->a();

Expected result:
----------------
i deem section 1 should be no error,while it give me a notice.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-16 11:49 UTC] cataphract@php.net
-Status: Open +Status: Duplicate
 [2010-12-16 11:49 UTC] cataphract@php.net
Already addressed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC