ID: 34990 Updated by: [EMAIL PROTECTED] Reported By: olympic at dino-online dot de -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: all PHP Version: 5.0.5 New Comment:
We will not change this behavior in the PHP 4 and 5 versions as it will break scripts. It's on the list for PHP 6. Previous Comments: ------------------------------------------------------------------------ [2005-10-26 11:11:40] olympic at dino-online dot de Description: ------------ In static calls $this is set. While in theory it might make sense to allow objects of the same class (or derived class) to "use" this feature, it's a potential pitfall and from my point of view it's bug. I think if a non static method is called statically then $this can't be any object that hasn't been created by this or a derive class. No other language has such a "feature" :) If it's not a bug, then read my bugreport as "remove this feature". If it's a bug, add a runtime checking for $this is object created by same or derived class. Reproduce code: --------------- Example: Noone can really say that this is "transparen" ok: class Foo { private $hallo="I am from Foo"; function dontCallMe() { return $this->hallo; } } class Bar { public $hallo="I am from Bar"; function testMe() { return Foo::dontCallMe(); } } $x=new Bar(); echo ($x->testMe()); // expected runtime error... Expected result: ---------------- Runtime error. Actual result: -------------- output is: "I am from Bar" This return the member var of Bar, what you would NEVER expect. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34990&edit=1