Fix ActionController compatibility with older Zend Versions

refs #4643
This commit is contained in:
Jannis Moßhammer 2013-08-27 17:49:25 +02:00
parent 0b515e39ac
commit 3d3fa45838
1 changed files with 21 additions and 0 deletions

View File

@ -230,4 +230,25 @@ class ActionController extends ZfController
}
}
}
/**
* Try to call compatible methods from older zend versions
*
* Methods like getParam and redirect are _getParam/_redirect in older Zend versions (which reside for example
* in Debian Wheezy). Using those methods without the "_" causes the application to fail on those platforms, but
* using the version with "_" forces us to use deprecated code. So we try to catch this issue by looking for methods
* with the same name, but with a "_" prefix prepended.
*
* @param string $name The method name to check
* @param array $params The method parameters
*/
public function __call($name, $params)
{
$deprecatedMethod = '_'.$name;
if (method_exists($this, $deprecatedMethod)) {
return call_user_func_array(array($this, $deprecatedMethod), $params);
}
return parent::__call($name, $params);
}
}