php5.0.2 - Access to undeclared static property
Brought to you by:
dstogov
Always, after first "recompiling" php file, I have this
error:
Fatal error: Access to undeclared static property:
test::$test in
on line 12
<code> <?php
class Test
{
static private $Test;
private $sInfo = 'text';
static public function getTest()
{
if( empty( self::$Test ) )
{
self::$Test = new Test;
}
return self::$Test;
}
public function fun1()
{
echo 'fun1: '. $this->sInfo ;
}
}
$T1 = Test::getTest();
$T1->fun1();
?></code>
Windows Xp, apache 2.0 , PHP 5.0.2 ,
Turck_MMCache_v2.4.7-CVS_for_PHP_v5.0.2.dll (downloaded
from
http://localfoo.info/modules/ipboard/index.php?showtopic=364&st=0
)
Logged In: YES
user_id=1117304
<?php
class Test
{
static public $Test;
}
echo "Test"; // this will write "test", not "Test"
echo Test::$Test;
?>
above code generate same error.
this error only occurs if property name is exactly same as
class name.
because mmcache register strings table with key 'Test' and
change value 'test'.