Report abuse


			
Index: controller/AgaviController.class.php
===================================================================
--- controller/AgaviController.class.php	(revision 2101)
+++ controller/AgaviController.class.php	(working copy)
@@ -70,6 +70,11 @@
 	protected $outputTypes = array();
 	
 	/**
+	 * @var        array Ref to the request data object from the request.
+	 */
+	private $requestData = null;
+	
+	/**
 	 * Indicates whether or not a module has a specific action.
 	 *
 	 * @param      string A module name.
@@ -131,7 +136,7 @@
 		// create a new execution container
 		$ecfi = $this->context->getFactoryInfo('execution_container');
 		$container = new $ecfi['class']();
-		$container->initialize($this->context, $ecfi['parameters']);
+		$container->initialize($this->context, clone $this->requestData, $ecfi['parameters']);
 		$container->setModuleName($moduleName);
 		$container->setActionName($actionName);
 		if($arguments !== null) {
@@ -479,6 +484,8 @@
 	 */
 	public function startup()
 	{
+		// grab a pointer to the request data
+		$this->requestData = $this->context->getRequest()->getRequestData();
 	}
 
 	/**
Index: controller/AgaviExecutionContainer.class.php
===================================================================
--- controller/AgaviExecutionContainer.class.php	(revision 2101)
+++ controller/AgaviExecutionContainer.class.php	(working copy)
@@ -43,7 +43,7 @@
 	/**
 	 * @var        AgaviRequestDataHolder A request data holder with request info.
 	 */
-	protected $requestData = null;
+	private $requestData = null;
 
 	/**
 	 * @var        AgaviRequestDataHolder A request data holder with arguments.
@@ -143,11 +143,13 @@
 	 * @author     David Zülke 
 	 * @since      0.11.0
 	 */
-	public function initialize(AgaviContext $context, array $parameters = array())
+	public function initialize(AgaviContext $context, AgaviRequestDataHolder $rd, array $parameters = array())
 	{
 		$this->microtime = microtime(true);
 
 		$this->context = $context;
+		
+		$this->requestData = $rd;
 
 		$this->parameters = $parameters;
 	}
@@ -296,8 +298,6 @@
 				// run the execution filter, without a proper chain
 				$controller->getFilter('execution')->execute(new AgaviFilterChain(), $this);
 			} else {
-				$this->requestData = clone $request->getRequestData();
-
 				if($this->arguments !== null) {
 					$this->requestData->merge($this->arguments);
 				}
@@ -400,9 +400,11 @@
 	 * @author     David Zülke 
 	 * @since      0.11.0
 	 */
-	public function getRequestData()
+	public final function getRequestData()
 	{
-		return $this->requestData;
+		if($this->actionInstance !== null) {
+			return $this->requestData;
+		}
 	}
 
 	/**
Index: request/AgaviXmlrpcepiphpRequest.class.php
===================================================================
--- request/AgaviXmlrpcepiphpRequest.class.php	(revision 2101)
+++ request/AgaviXmlrpcepiphpRequest.class.php	(working copy)
@@ -54,20 +54,19 @@
 		}
 		
 		$rdhc = $this->getParameter('request_data_holder_class');
-		$this->requestData = new $rdhc(array(
-			constant("$rdhc::SOURCE_PARAMETERS") => array(),
+		$rd = new $rdhc(array(
+			constant("$rdhc::SOURCE_PARAMETERS") => (array)$decoded,
 		));
 		
-		
-		$this->requestData->setParameters((array)$decoded);
-		
 		$split = explode(':', $this->invokedMethod);
 		if(count($split) == 2) {
-			$this->requestData->setParameter($this->getParameter('module_accessor'), $split[0]);
-			$this->requestData->setParameter($this->getParameter('action_accessor'), $split[1]);
+			$rd->setParameter($this->getParameter('module_accessor'), $split[0]);
+			$rd->setParameter($this->getParameter('action_accessor'), $split[1]);
 		} else {
-			$this->requestData->setParameter($this->getParameter('action_accessor'), $this->invokedMethod);
+			$rd->setParameter($this->getParameter('action_accessor'), $this->invokedMethod);
 		}
+		
+		$this->setRequestData($rd);
 	}
 }
 
Index: request/AgaviWebRequest.class.php
===================================================================
--- request/AgaviWebRequest.class.php	(revision 2101)
+++ request/AgaviWebRequest.class.php	(working copy)
@@ -378,12 +378,12 @@
 		}
 
 		$rdhc = $this->getParameter('request_data_holder_class');
-		$this->requestData = new $rdhc(array(
+		$this->setRequestData(new $rdhc(array(
 			constant("$rdhc::SOURCE_PARAMETERS") => array_merge($_GET, $_POST),
 			constant("$rdhc::SOURCE_COOKIES") => $_COOKIE,
 			constant("$rdhc::SOURCE_FILES") => $_FILES,
 			constant("$rdhc::SOURCE_HEADERS") => $headers,
-		));
+		)));
 	}
 
 	/**
Index: request/AgaviRequest.class.php
===================================================================
--- request/AgaviRequest.class.php	(revision 2101)
+++ request/AgaviRequest.class.php	(working copy)
@@ -54,7 +54,7 @@
 	/**
 	 * @var        AgaviRequestDataHolder The request data holder instance.
 	 */
-	protected $requestData = null;
+	private $requestData = null;
 
 	/**
 	 * @var        bool A boolean value indicating whether or not the request is 
@@ -173,21 +173,34 @@
 	}
 
 	/**
+	 * Set the data holder instance of this request.
+	 *
+	 * @param      AgaviRequestDataHolder The request data holder.
+	 *
+	 * @author     David Zülke 
+	 * @author     Dominik del Bondio 
+	 * @since      0.11.0
+	 */
+	final protected function setRequestData(AgaviRequestDataHolder $rd)
+	{
+		if(!$this->locked) {
+			$this->requestData = $rd;
+		}
+	}
+
+	/**
 	 * Get the data holder instance of this request.
 	 *
 	 * @return     AgaviRequestDataHolder The request data holder.
 	 *
+	 * @author     David Zülke 
 	 * @author     Dominik del Bondio 
 	 * @since      0.11.0
 	 */
-	public function getRequestData()
+	final public function getRequestData()
 	{
 		if($this->locked) {
-			if($this->getParameter('request_lock_barf', true)) {
-				throw new AgaviException("Access to request data is locked during Action and View execution, please use the local request data holder passed to your Action's or View's execute*() method to access request data.\nYou may disable the throwing of this exception by setting the 'request_lock_barf' parameter to false. Sorry for the name of that one, 'throw_exception_when_trying_to_access_request_data_while_request_is_locked' is just a little too long.");
-			} else {
-				return new AgaviRequestDataHolder();
-			}
+			return new AgaviRequestDataHolder();
 		}
 		return $this->requestData;
 	}
Index: request/AgaviSoapRequest.class.php
===================================================================
--- request/AgaviSoapRequest.class.php	(revision 2101)
+++ request/AgaviSoapRequest.class.php	(working copy)
@@ -62,10 +62,10 @@
 		parent::initialize($context, $parameters);
 		
 		$rdhc = $this->getParameter('request_data_holder_class');
-		$this->requestData = new $rdhc(array(
+		$this->setRequestData(new $rdhc(array(
 			constant("$rdhc::SOURCE_PARAMETERS") => array(),
 			constant("$rdhc::SOURCE_HEADERS") => array(),
-		));
+		)));
 		
 		$this->setMethod($this->getParameter('default_method', 'read'));
 	}