#25220 [Opn->Csd]: Statically called members can access $this

From: Date: Sat, 29 Nov 2003 01:46:26 +0000
Subject: #25220 [Opn->Csd]: Statically called members can access $this
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-51278@lists.php.net to get a copy of this message
ID: 25220 Updated by: sniper@php.net -Summary: Staticaly called members can access $this Reported By: php at koert dot bitfactory dot nl -Status: Open +Status: Closed Bug Type: Zend Engine 2 problem Operating System: Cygwin/win2k PHP Version: 5CVS-2003-08-23 (dev) New Comment: Output with latest CVS: PHP Notice: Undefined property: testclass::$variable in /home/jani/t.php on line 4 Previous Comments: ------------------------------------------------------------------------ [2003-08-23 11:19:11] php at koert dot bitfactory dot nl Description: ------------ If a static method is called from an objectcontext, $this is accessible from that objectcontext. $this should be out of scop in the static method... Reproduce code: --------------- class static_class { function static_func() { echo $this->variable; } } class testclass { function func() { static_class::static_func(); } } $x = new testclass(); $x->func(); Expected result: ---------------- <br /> <b>Fatal error</b>: Using $this when not in object context in <b>[filename]</b> on line <b>2</b><br /> Actual result: -------------- No output (thus no error) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25220&edit=1

« previous php.bugs (#51278) next »