diff -r 5e7a0fedabdf -r 877f952ae2bd web/lib/Zend/Controller/Action.php --- a/web/lib/Zend/Controller/Action.php Thu Mar 21 17:31:31 2013 +0100 +++ b/web/lib/Zend/Controller/Action.php Thu Mar 21 19:50:53 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Action.php 22792 2010-08-05 18:30:27Z matthew $ + * @version $Id: Action.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -37,7 +37,7 @@ /** * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Controller_Action implements Zend_Controller_Action_Interface @@ -505,14 +505,18 @@ $this->_classMethods = get_class_methods($this); } - // preDispatch() didn't change the action, so we can continue - if ($this->getInvokeArg('useCaseSensitiveActions') || in_array($action, $this->_classMethods)) { - if ($this->getInvokeArg('useCaseSensitiveActions')) { - trigger_error('Using case sensitive actions without word separators is deprecated; please do not rely on this "feature"'); + // If pre-dispatch hooks introduced a redirect then stop dispatch + // @see ZF-7496 + if (!($this->getResponse()->isRedirect())) { + // preDispatch() didn't change the action, so we can continue + if ($this->getInvokeArg('useCaseSensitiveActions') || in_array($action, $this->_classMethods)) { + if ($this->getInvokeArg('useCaseSensitiveActions')) { + trigger_error('Using case sensitive actions without word separators is deprecated; please do not rely on this "feature"'); + } + $this->$action(); + } else { + $this->__call($action, array()); } - $this->$action(); - } else { - $this->__call($action, array()); } $this->postDispatch(); } @@ -579,8 +583,24 @@ */ protected function _getParam($paramName, $default = null) { + return $this->getParam($paramName, $default); + } + + /** + * Gets a parameter from the {@link $_request Request object}. If the + * parameter does not exist, NULL will be returned. + * + * If the parameter does not exist and $default is set, then + * $default will be returned instead of NULL. + * + * @param string $paramName + * @param mixed $default + * @return mixed + */ + public function getParam($paramName, $default = null) + { $value = $this->getRequest()->getParam($paramName); - if ((null === $value || '' === $value) && (null !== $default)) { + if ((null === $value || '' === $value) && (null !== $default)) { $value = $default; } @@ -593,9 +613,23 @@ * @param string $paramName * @param mixed $value * @return Zend_Controller_Action + * @deprecated Deprecated as of Zend Framework 1.7. Use + * setParam() instead. */ protected function _setParam($paramName, $value) { + return $this->setParam($paramName, $value); + } + + /** + * Set a parameter in the {@link $_request Request object}. + * + * @param string $paramName + * @param mixed $value + * @return Zend_Controller_Action + */ + public function setParam($paramName, $value) + { $this->getRequest()->setParam($paramName, $value); return $this; @@ -607,9 +641,23 @@ * * @param string $paramName * @return boolean + * @deprecated Deprecated as of Zend Framework 1.7. Use + * hasParam() instead. */ protected function _hasParam($paramName) { + return $this->hasParam($paramName); + } + + /** + * Determine whether a given parameter exists in the + * {@link $_request Request object}. + * + * @param string $paramName + * @return boolean + */ + public function hasParam($paramName) + { return null !== $this->getRequest()->getParam($paramName); } @@ -618,9 +666,22 @@ * as an associative array. * * @return array + * @deprecated Deprecated as of Zend Framework 1.7. Use + * getAllParams() instead. */ protected function _getAllParams() { + return $this->getAllParams(); + } + + /** + * Return all parameters in the {@link $_request Request object} + * as an associative array. + * + * @return array + */ + public function getAllParams() + { return $this->getRequest()->getParams(); } @@ -650,9 +711,42 @@ * @param string $module * @param array $params * @return void + * @deprecated Deprecated as of Zend Framework 1.7. Use + * forward() instead. */ final protected function _forward($action, $controller = null, $module = null, array $params = null) { + $this->forward($action, $controller, $module, $params); + } + + /** + * Forward to another controller/action. + * + * It is important to supply the unformatted names, i.e. "article" + * rather than "ArticleController". The dispatcher will do the + * appropriate formatting when the request is received. + * + * If only an action name is provided, forwards to that action in this + * controller. + * + * If an action and controller are specified, forwards to that action and + * controller in this module. + * + * Specifying an action, controller, and module is the most specific way to + * forward. + * + * A fourth argument, $params, will be used to set the request parameters. + * If either the controller or module are unnecessary for forwarding, + * simply pass null values for them before specifying the parameters. + * + * @param string $action + * @param string $controller + * @param string $module + * @param array $params + * @return void + */ + final public function forward($action, $controller = null, $module = null, array $params = null) + { $request = $this->getRequest(); if (null !== $params) { @@ -680,9 +774,25 @@ * @param string $url * @param array $options Options to be used when redirecting * @return void + * @deprecated Deprecated as of Zend Framework 1.7. Use + * redirect() instead. */ protected function _redirect($url, array $options = array()) { + $this->redirect($url, $options); + } + + /** + * Redirect to another URL + * + * Proxies to {@link Zend_Controller_Action_Helper_Redirector::gotoUrl()}. + * + * @param string $url + * @param array $options Options to be used when redirecting + * @return void + */ + public function redirect($url, array $options = array()) + { $this->_helper->redirector->gotoUrl($url, $options); } }