#120 constructor of class named upper case didn't get call

open
nobody
None
5
2014-07-16
2005-05-24
Pigkeeper
No

I wrote a small test case and found that if I name my
PHP class that first letter is Upper case, after the
MMCache cashed that page, the constructor of that PHP
class will not get call. It works fine for lower case
PHP class.

this is my test case:
/*********
begin myobjtest.php
*********/
<?php

class myobj
{
var $fileName;

function myobj($arg)
{
$this->fileName = $arg;
echo "in constructor of myobj, file name is
".$this->fileName."<br>";
}
}

class Myobj1
{
var $fileName;

function Myobj1($arg)
{
$this->fileName = $arg;
echo "in constructor of Myobj1, file name is
".$this->fileName."<br>";
}
}

$temp = new myobj("myfile123");
echo "mytest object is $temp<br>";
print_r($temp);
echo "<p>";

$temp1 = new Myobj1("myfile123");
echo "Myobj1 object is $temp1<br>";
print_r($temp1);
echo "<p>";
?>

//end myobjtest.php

/***************************************************
this is the output
***********************************************/
/*****
enabled MMCache
******/

first time running: (no problem)
-------------------------------------------------
in constructor of myobj, file name is myfile123
mytest object is Object id #2
myobj Object ( [fileName] => myfile123 )

in constructor of MyObj1, file name is myfile123
MyObj1 object is Object id #3
MyObj1 Object ( [fileName] => myfile123 )
-------------------------------------------------

second time: ( HAS Problem *_* )
--------------------------------------------------
in constructor of myobj, file name is myfile123
mytest object is Object id #2
myobj Object ( [fileName] => myfile123 )

MyObj1 object is Object id #3
MyObj1 Object ( [fileName] => )
----------------------------------------------------

in second time, class MyObj1's constructor didn't get
called

/*******
disabled MMCache
********/

first time, second time running are the same: (no
problem)
---------------------------------------------------
in constructor of myobj, file name is myfile123
mytest object is Object id #2
myobj Object ( [fileName] => myfile123 )

in constructor of MyObj1, file name is myfile123
MyObj1 object is Object id #3
MyObj1 Object ( [fileName] => myfile123 )
---------------------------------------------------

as you can see, if enabled MMCache, in the second time
running which MMcache has cached the page, the output
statement from the constructor of Myobj1 is missing,
and also the filename object of Myobj1 is empty. So
my conclusion is the explicit constructor of Myobj1
didn't get calling.

Discussion