2010年4月12日

Joomla 1.5 和 PHP 5.3.2 不相容

今天追一個 Joomla 的問題,應該和 PHP5.3 不相容有關。系統 Package 不要亂升級,很容易出事!



特徵是「選單」會全部不見!


在 httpd-error.log 會有類似下列的錯誤訊息。


[Mon Apr 12 18:15:00 2010] [error] [client 140.xxx.xxx.xxx] PHP Warning:  Parameter 4 to JHTMLMenu::treerecurse() expected to be a reference, value given in {Joomla}/libraries/joomla/html/html.php on line 87, referer: http://{Joomla_site}//administrator/index.php?option=com_menus&task=view&menutype=mainmenu2 
[Mon Apr 12 18:15:00 2010] [error] [client 140.xxx.xxx.xxx] PHP Warning: array_slice() expects parameter 1 to be array, null given in {Joomla}/administrator/components/com_menus/models/list.php on line 143, referer: http://{Joomla_site}//administrator/index.php?option=com_menus&task=view&menutype=mainmenu2
[Mon Apr 12 18:15:00 2010] [error] [client 140.xxx.xxx.xxx] PHP Warning: Invalid argument supplied for foreach() in {Joomla}/administrator/components/com_menus/models/list.php on line 147, referer: http://{Joomla_site}//administrator/index.php?option=com_menus&task=view&menutype=mainmenu2
[Mon Apr 12 18:15:00 2010] [error] [client 140.xxx.xxx.xxx] PHP Warning: Invalid argument supplied for foreach() in {Joomla}/administrator/components/com_menus/views/list/view.php on line 65, referer: http://{Joomla_site}//administrator/index.php?option=com_menus&task=view&menutype=mainmenu2
[Mon Apr 12 18:15:00 2010] [error] [client 140.xxx.xxx.xxx] PHP Warning: Invalid argument supplied for foreach() in {Joomla}/administrator/components/com_menus/views/list/tmpl/default.php on line 69, referer: http://{Joomla_site}//administrator/index.php?option=com_menus&task=view&menutype=mainmenu2

這個要修改 libraries/joomla/html/html.php 第 85 行的


if (is_callable( array( $className, $func ) )) 
{
$args = func_get_args();
array_shift( $args );
return call_user_func_array( array( $className, $func ), $args );
}
else

改成


if (is_callable( array( $className, $func ) )) 
{
$temp=func_get_args();
array_shift( $temp );
$args = array();
foreach ($temp as $k => $v) {
$args[] = &$temp[$k];
}
return call_user_func_array( array( $className, $func ), $args );
}
else

參考自此頁


 


另外,httpd-error.log會有


[Mon Apr 12 21:37:21 2010] [error] [client 59.115.188.15] PHP Warning:  Parameter 1 to modMainMenuHelper::buildXML() expected to be a reference, value given in {Joomla}/libraries/joomla/cache/handler/callback.php on line 99 

這個修改 modules/mod_mainmenu/helper.php 第 31 行, 由


function buildXML(&$params) 

改成


function buildXML($params) 

參考自此頁




Orignal From: Joomla 1.5 和 PHP 5.3.2 不相容