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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 15:01:27 2025 UTC