Joomla 1.5.14 和 PHP 5.3.2 不相容 |
2010/04/12 ~ 阿亮 ~ |
今天追一個 Joomla 的問題,和 PHP 升級到 5.3 造成不相容有關。
結論:系統 Package (比如 PHP 5.2.X–> PHP 5.3.X) 不要亂升級,很容易出事!要很花時間去追問題。
特徵是「選單」會全部不見!在 httpd-error.log 會有類似下列的錯誤訊息。
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 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 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 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 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會有
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)
thanks 我也遇到这问题了
welcome