ID: 39664 Updated by: [EMAIL PROTECTED] Reported By: john dot hargrove at sellingsource dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Gentoo Linux 2.6 kernel PHP Version: 5.2.0 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2006-11-28 19:03:04] john dot hargrove at sellingsource dot com Description: ------------ PHP5 allows you to invoke a non-static method as static if you have E_STRICT disabled through the Class::Method() syntax which is intended functionality. I believe this bug may actually be a throwback to PHP4 functionality, but it results in funky error reporting in PHP5. If you make a static call to a non-static method, from an instance of another class, the $this variable is in scope from the calling instance. This breaks visibility and scope rules. Note that I saw all the PHP4 bug reports for this marked as bogus for reasons that made sense, but did not see a PHP5 bug marked similarly. The only reason I can see for this is compatibility? Also of note is that the method is aware of being out of the context of an object if called from the global scope. This only occurs from the context of an object (which makes sense). Reproduce code: --------------- <?php class A { private $private_var; public function Tester() { echo $this->private_var; } } class B { public function TesterBlah() { A::Tester(); } } $b = new B(); $b->TesterBlah(); ?> Expected result: ---------------- Fatal error: Using $this when not in object context in /root/bug/test.php on line 8 Actual result: -------------- Notice: Undefined property: B::$private_var in /root/bug/test.php on line 8 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39664&edit=1