Bug #65911 [NEW]: scope resolution operator - strange behavior with $this

From: Date: Wed, 16 Oct 2013 09:23:06 +0000
Subject: Bug #65911 [NEW]: scope resolution operator - strange behavior with $this
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182310@lists.php.net to get a copy of this message
From: ori at uumpa dot com Operating system: ubuntu 13.04 PHP version: 5.4.20 Package: Class/Object related Bug Type: Bug Bug description:scope resolution operator - strange behavior with $this 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 bug report at https://bugs.php.net/bug.php?id=65911&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65911&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=65911&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65911&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65911&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65911&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65911&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65911&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65911&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65911&r=support Expected behavior: https://bugs.php.net/fix.php?id=65911&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65911&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65911&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65911&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65911&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65911&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65911&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65911&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65911&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65911&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65911&r=mysqlcfg

« previous php.bugs (#182310) next »