Bug #65911 [Opn->Csd]: scope resolution operator - strange behavior with $this

From: Date: Wed, 16 Oct 2013 16:42:55 +0000
Subject: Bug #65911 [Opn->Csd]: scope resolution operator - strange behavior with $this
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182317@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65911&edit=1 ID: 65911 Updated by: nikic@php.net Reported by: ori at uumpa dot com Summary: scope resolution operator - strange behavior with $this -Status: Open +Status: Closed Type: Bug Package: Class/Object related Operating System: ubuntu 13.04 PHP Version: 5.4.20 Block user comment: N Private report: N New Comment: Automatic comment on behalf of bobwei9@hotmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=4c0bb6d76eb0c8b9fdc74c3c8858a146ab34e2f8 Log: Fixed bug #65911 ($this not usable as static property) Previous Comments: ------------------------------------------------------------------------ [2013-10-16 09:23:06] ori at uumpa dot com Description: ------------ When using the scope resolution operator with $this it ignores everything before the scope operator and just returns whatever is after the scope operator for example, if we are inside an object with attribute foo: STATIC_CLASS::$this->foo the above script returns $this->foo I assume it should raise an error (Access to undeclared static property) Test script: --------------- class A {} class B { public function go() { $this->foo = 'bar'; echo A::$this->foo; // 'bar' } } $obj = new B(); $obj->go(); Expected result: ---------------- it should raise a fatal error - Access to undeclared property A::$this Actual result: -------------- It does not raise an error and just echoes 'bar' ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65911&edit=1

« previous php.bugs (#182317) next »