Guus Koning
asked this on September 04, 2011 22:23
I get an syntax error on line 23 of abstract_class.php.
In the browser it says:
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/httpd/vhosts/guus.koning.huweb.nl/httpdocs/layar/abstract_class.php on line 23
Comments latest first
I got an error, when the program try to call the function get_called_class because this function is available only with PHP 5.3, but my hosting provider has PHP 5.2.7.
The solution of this problem is to add the following code, in the beginning of the program"abstract_class.php".
if (!function_exists('get_called_class')):
function get_called_class()
{
$bt = debug_backtrace();
$lines = file($bt[1]['file']);
preg_match('/([a-zA-Z0-9\_]+)::'.$bt[1]['function'].'/',
$lines[$bt[1]['line']-1],
$matches);
if(empty($matches[1])){
$pp= serialize( $bt[1]["object"]);
$nx=strpos($pp,'"')+1;
$nx=substr($pp,$nx,strpos($pp,'"'));
if (!empty($nx))
{
echo " RETURING....: (". $nx . ")<br>";
return $nx;
}
}
echo " RETURING....: (" . $matches[1] . ")<br>";
return $matches[1];
}
endif;
Xuan,
My provider has updated to PHP version 5.3.
Thanks
Hi Guus,
I will have a look at it. But the easiest solution could be that you upgrade your php to v5.3.x.
Best regards,
Xuan
Xuan,
I've downloaded the code of the latets tutorial and now I get another error:
Fatal error: Call to undefined function get_called_class() in /home/httpd/vhosts/guus.koning.huweb.nl/httpdocs/layar/abstract_class.php on line 47
On the server runs PHP 5.2.17
Hi Guus,
It is an interesting error message (in Hebrew) which means the "::" (scope resolution operator) is not expected. I do not have this issue running php 5.3.x. What is the php version that you are using ? You can change "::" to "->" on that line to get it work.
Please let us know.
Best Regards,
Xuan