#19194 [Opn->Fbk]: Static class usage, maybe bug maybe not
| From: | stas@php.net | Date: | Mon, 09 Sep 2002 15:46:44 +0000 |
| Subject: | #19194 [Opn->Fbk]: Static class usage, maybe bug maybe not | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-18814@lists.php.net to get a copy of this message | ||
ID: 19194
Updated by: stas@php.net
Reported By: Jevgenijs.Junkins@verdi.lv
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Corel Linux
PHP Version: 4.2.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
Works for me with latest CVS (i.e., says "do something").
Previous Comments:
------------------------------------------------------------------------
[2002-08-30 05:59:39] Jevgenijs.Junkins@verdi.lv
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 this bug report at http://bugs.php.net/?id=19194&edit=1