eaccelerator incorrectly calls a method that shouldn't get called in php5. php5 w/o eaccelerator doesn't behave this way. my php5 class has a construct() method and happens to have a method with the same name of the class, but in lower case, but eaccelerator calls the class name method and not the construct() method during instantiation.
Hit the blow script twice to see the issue. The first time the script is hit, it works fine, but the second time eacclerator fails.
<?php
class Debug {
protected $test = '';
function __construct() {
echo "constructor!";
}
public static function singleton() {
static $obj=NULL;
if (is_null($obj)) {
$obj = new Debug;
}
return $obj;
}
function debug($str) {
//doo something with $str;
echo "Debug::".$str;
}
function alert($str) {
echo "Alert::".$str;
}
}
$obj = Debug::singleton();
$obj->alert('foo');
$obj->debug('bar');
?>
this results in
Warning: Missing argument 1 for Debug::debug(), called in /home/wboring/devel/trunk/htdocs/admin/test.php on line 13 and defined in /home/wboring/devel/trunk/htdocs/admin/test.php on line 19
Call Stack
# Function Location
1 {main}() /home/wboring/devel/trunk/htdocs/admin/test.php:0
2 Debug::singleton() /home/wboring/devel/trunk/htdocs/admin/test.php:31
3 Debug->debug() /home/wboring/devel/trunk/htdocs/admin/test.php:13
Notice: Undefined variable: str in /home/wboring/devel/trunk/htdocs/admin/test.php on line 21
Call Stack
# Function Location
1 {main}() /home/wboring/devel/trunk/htdocs/admin/test.php:0
2 Debug::singleton() /home/wboring/devel/trunk/htdocs/admin/test.php:31
3 Debug->debug() /home/wboring/devel/trunk/htdocs/admin/test.php:13
Debug::Alert::fooDebug::bar