[FOLLOWUP][BUGFIX] Skip cache hash for URIs to non-cacheable actions 75/37675/3
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Mon, 9 Mar 2015 18:29:16 +0000 (19:29 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 10 Mar 2015 14:25:11 +0000 (15:25 +0100)
Fix fatal error in page module when user is in some workspace

Resolves: #65629
Relates: #60272
Releases: master
Change-Id: I05a6b3bdccff8bfc49ff0c0619ee5db5e4de1a22
Reviewed-on: http://review.typo3.org/37675
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/extbase/Classes/Mvc/Web/Routing/UriBuilder.php

index c67bc98..9f92b14 100644 (file)
@@ -17,6 +17,8 @@ namespace TYPO3\CMS\Extbase\Mvc\Web\Routing;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Mvc\Request;
+use TYPO3\CMS\Extbase\Mvc\Web\Request as WebRequest;
 
 /**
  * An URI Builder
@@ -45,7 +47,7 @@ class UriBuilder {
        protected $contentObject;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Mvc\Web\Request
+        * @var Request
         */
        protected $request;
 
@@ -144,16 +146,16 @@ class UriBuilder {
        /**
         * Sets the current request
         *
-        * @param \TYPO3\CMS\Extbase\Mvc\Request $request
+        * @param Request $request
         * @return \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder the current UriBuilder to allow method chaining
         */
-       public function setRequest(\TYPO3\CMS\Extbase\Mvc\Request $request) {
+       public function setRequest(Request $request) {
                $this->request = $request;
                return $this;
        }
 
        /**
-        * @return \TYPO3\CMS\Extbase\Mvc\Web\Request
+        * @return Request
         */
        public function getRequest() {
                return $this->request;
@@ -547,7 +549,8 @@ class UriBuilder {
                                $controllerArguments['controller'],
                                $controllerArguments['action']
                        );
-                       $this->setUseCacheHash($this->request->isCached() || $actionIsCacheable);
+                       $isRequestCached = $this->request instanceof WebRequest && $this->request->isCached();
+                       $this->setUseCacheHash($isRequestCached || $actionIsCacheable);
                }
        }
 
@@ -642,7 +645,7 @@ class UriBuilder {
                if ($this->section !== '') {
                        $uri .= '#' . $this->section;
                }
-               if ($this->createAbsoluteUri === TRUE) {
+               if ($this->request instanceof WebRequest && $this->createAbsoluteUri) {
                        $uri = $this->request->getBaseUri() . $uri;
                }
                return $uri;