#19194 [NEW]: Static class usage, maybe bug maybe not

From: Date: Fri, 30 Aug 2002 09:59:40 +0000
Subject: #19194 [NEW]: Static class usage, maybe bug maybe not
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18237@lists.php.net to get a copy of this message
From: Jevgenijs.Junkins@verdi.lv Operating system: Corel Linux PHP version: 4.2.2 PHP Bug Type: Scripting Engine problem Bug description: Static class usage, maybe bug maybe not I have a problem with static method usage (Classname::methodname()) here are two classes, for example: <code> class test1 { var $prop1; var $prop2; function test1($val1, $val2){ $this->prop1 = $val1; $this->prop2 = $val2; } function test_method(){ if($this){ var_dump($this); } else { echo "do something" } } } class test2 { function test2(){ } function run(){ test1::test_method(); } } t_obj = new test2(); t_obj->run(); </code> I will always get output of var_dump, because in method of test1 test_method() $this is always set and it is reference or copy of initialized test2 class Check of $this in test_method is required to check if it is static call or from this object, but it does not work, I think this is not correct behavior -- Edit bug report at http://bugs.php.net/?id=19194&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=19194&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=19194&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=19194&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=19194&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=19194&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=19194&r=support Expected behavior: http://bugs.php.net/fix.php?id=19194&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=19194&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=19194&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=19194&r=globals

« previous php.bugs (#18237) next »