Fixing call-time pass-by-ref errors in Behavior

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6533 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-03-09 07:00:05 +00:00
parent e87d4e80dd
commit ab7bf5a46c

View file

@ -153,7 +153,7 @@ class ModelBehavior extends Object {
*/ */
function dispatchMethod(&$model, $method, $params = array()) { function dispatchMethod(&$model, $method, $params = array()) {
if (empty($params)) { if (empty($params)) {
return $this->{$method}(&$model); return $this->{$method}($model);
} }
$params = array_values($params); $params = array_values($params);
@ -169,7 +169,7 @@ class ModelBehavior extends Object {
case 5: case 5:
return $this->{$method}($model, $params[0], $params[1], $params[2], $params[3], $params[4]); return $this->{$method}($model, $params[0], $params[1], $params[2], $params[3], $params[4]);
default: default:
array_unshift($params, &$model); array_unshift($params, $model);
return call_user_func_array(array(&$this, $method), $params); return call_user_func_array(array(&$this, $method), $params);
break; break;
} }
@ -438,7 +438,7 @@ class BehaviorCollection extends Object {
if (in_array($name, $this->_disabled)) { if (in_array($name, $this->_disabled)) {
continue; continue;
} }
$result = $this->{$name}->dispatchMethod(&$model, $callback, $params); $result = $this->{$name}->dispatchMethod($model, $callback, $params);
if ($options['break'] && ($result === $options['breakOn'] || is_array($options['breakOn'] && in_array($result, $options['breakOn'], true)))) { if ($options['break'] && ($result === $options['breakOn'] || is_array($options['breakOn'] && in_array($result, $options['breakOn'], true)))) {
return $result; return $result;