2012年3月6日火曜日

[CakePHP] Fatal Error on CakePHP 1.1 core with PHP 5.3

I'm trying to run a project written in CakePHP 1.1 on a server PHP 5.3.6, but fails...
These are the errors:
Warning: call_user_func_array() expects parameter 2 to be array, null given in cake/dispatcher.php on line 268

I'm trying to convert cake/dispatcher.php to be prepared for PHP 5.3 and repaired it like this:
--- dispatcher.php.20120306 2007-03-24 01:36:28.000000000 +0900
+++ dispatcher.php 2012-03-06 16:03:48.000000000 +0900
@@ -265,7 +265,11 @@
uses(DS.'controller'.DS.'scaffold');
return new Scaffold($controller, $params);
} else {
- $output = call_user_func_array(array(&$controller, $params['action']), empty($params['pass'])? null: $params['pass']);
+ // For PHP5.3
+ $functionname=$params['action'];
+ if (empty($params['pass'])) $output = $controller->$functionname();
+ else $output = call_user_func_array(array(&$controller, $params['action']), $params['pass']);
}
if ($controller->autoRender) {
$output = $controller->render();

0 件のコメント: