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
 [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-2020 The PHP Group
All rights reserved.
Last updated: Wed Feb 26 14:01:28 2020 UTC