[BUGFIX] Clean MP parameter for rootline cache identifier 21/28521/5
authorAlexander Stehlik <alexander.stehlik@gmail.com>
Tue, 25 Mar 2014 09:47:29 +0000 (10:47 +0100)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Tue, 25 Mar 2014 14:04:38 +0000 (15:04 +0100)
Any commas in the mount point parameter are replaced with underscores
to prevent caching errors in the RootlineUtility.

Resolves: #57073
Releases: 6.2
Change-Id: If1e135d0abbc08ebc11954d17f57ea037983ba10
Reviewed-on: https://review.typo3.org/28521
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Jost Baron
Tested-by: Jost Baron
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
typo3/sysext/core/Classes/Utility/RootlineUtility.php
typo3/sysext/core/Tests/Unit/Utility/RootlineUtilityTest.php

index e2eb280..e068a80 100644 (file)
@@ -178,9 +178,15 @@ class RootlineUtility {
         * @return string
         */
        public function getCacheIdentifier($otherUid = NULL) {
+
+               $mountPointParameter = (string)$this->mountPointParameter;
+               if ($mountPointParameter !== '' && strpos($mountPointParameter, ',') !== FALSE) {
+                       $mountPointParameter = str_replace(',', '__', $mountPointParameter);
+               }
+
                return implode('_', array(
                        $otherUid !== NULL ? (int)$otherUid : $this->pageUid,
-                       $this->mountPointParameter,
+                       $mountPointParameter,
                        $this->languageUid,
                        $this->workspaceUid,
                        $this->versionPreview ? 1 : 0
index a2944b3..5a2a2d5 100644 (file)
@@ -259,6 +259,19 @@ class RootlineUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        /**
         * @test
         */
+       public function getCacheIdentifierReturnsValidIdentifierWithCommasInMountPointParameter() {
+               /** @var \TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend $cacheFrontendMock */
+               $cacheFrontendMock = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Cache\\Frontend\\AbstractFrontend', array(), '', FALSE);
+               $this->pageContextMock->sys_language_uid = 8;
+               $this->pageContextMock->versioningWorkspaceId = 15;
+               $this->pageContextMock->versioningPreview = TRUE;
+               $this->fixture->__construct(42, '47-11,48-12', $this->pageContextMock);
+               $this->assertTrue($cacheFrontendMock->isValidEntryIdentifier($this->fixture->getCacheIdentifier()));
+       }
+
+       /**
+        * @test
+        */
        public function getRecordArrayFetchesTranslationWhenLanguageIdIsSet() {
                $pageData = array(
                        'uid' => 1,