[BUGFIX] Unset current file in generic Content Object Renderer 12/52812/2
authorBenjamin Serfhos <serfhos@gmail.com>
Mon, 29 Aug 2016 08:38:22 +0000 (10:38 +0200)
committerBenni Mack <benni@typo3.org>
Wed, 17 May 2017 06:19:06 +0000 (08:19 +0200)
When function is done, reset current file for further processing

Resolves: #77645
Releases: master, 8.7, 7.6
Change-Id: Ibae2e3221c51c8cb45f92b0bc7dbe395cc809605
Reviewed-on: https://review.typo3.org/52812
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/frontend/Classes/ContentObject/FilesContentObject.php

index c8dcdc0..0026ee2 100644 (file)
@@ -34,6 +34,8 @@ class FilesContentObject extends AbstractContentObject
         if (!empty($conf['if.']) && !$this->cObj->checkIf($conf['if.'])) {
             return '';
         }
+        // Store the original "currentFile" within a variable so it can be re-applied later-on
+        $originalFileInContentObject = $this->cObj->getCurrentFile();
 
         $fileCollector = $this->findAndSortFiles($conf);
         $fileObjects = $fileCollector->getFiles();
@@ -76,6 +78,10 @@ class FilesContentObject extends AbstractContentObject
             $fileObjectCounter++;
         }
 
+        // Reset current file within cObj to the original file after rendering output of FILES
+        // so e.g. stdWrap is not working on the last current file applied, thus avoiding side-effects
+        $this->cObj->setCurrentFile($originalFileInContentObject);
+
         return $this->cObj->stdWrap($content, $conf['stdWrap.']);
     }