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
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: smallslime at gmail dot com
New email:
PHP Version: OS:

 

 [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: Tue Feb 18 01:01:26 2020 UTC