[BUGFIX] Allow to render the same TS object twice 12/25512/7
authorMarkus Klein <klein.t3@mfc-linz.at>
Tue, 19 Nov 2013 17:36:53 +0000 (18:36 +0100)
committerAndreas Wolf <andreas.wolf@typo3.org>
Sun, 9 Feb 2014 13:30:00 +0000 (14:30 +0100)
CONTENT/RECORDS elements prevent to render the same object twice.

Resolves: #53768
Resolves: #28745
Releases: 6.2, 6.1, 6.0
Change-Id: I30750f2dc848521999c3734129439d7f6f90aae1
Reviewed-on: https://review.typo3.org/25512
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Stefano Kowalke
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php

index d1b2d46..795afc0 100644 (file)
@@ -47,7 +47,7 @@ class ContentContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractCon
                // If the currentRecord is set, we register, that this record has invoked this function.
                // It's should not be allowed to do this again then!!
                if ($originalRec) {
-                       $GLOBALS['TSFE']->recordRegister[$originalRec]++;
+                       ++$GLOBALS['TSFE']->recordRegister[$originalRec];
                }
                $conf['table'] = isset($conf['table.']) ? trim($this->cObj->stdWrap($conf['table'], $conf['table.'])) : trim($conf['table']);
                $renderObjName = $conf['renderObj'] ?: '<' . $conf['table'];
@@ -148,6 +148,9 @@ class ContentContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractCon
                }
                // Restore
                $GLOBALS['TSFE']->currentRecord = $originalRec;
+               if ($originalRec) {
+                       --$GLOBALS['TSFE']->recordRegister[$originalRec];
+               }
                return $theValue;
        }
 
index 47d2e6f..d187a7b 100644 (file)
@@ -68,7 +68,7 @@ class RecordsContentObject extends AbstractContentObject {
                // If the currentRecord is set, we register, that this record has invoked this function.
                // It's should not be allowed to do this again then!!
                if ($originalRec) {
-                       $GLOBALS['TSFE']->recordRegister[$originalRec]++;
+                       ++$GLOBALS['TSFE']->recordRegister[$originalRec];
                }
                $tables = isset($conf['tables.']) ? $this->cObj->stdWrap($conf['tables'], $conf['tables.']) : $conf['tables'];
                $source = isset($conf['source.']) ? $this->cObj->stdWrap($conf['source'], $conf['source.']) : $conf['source'];
@@ -146,6 +146,9 @@ class RecordsContentObject extends AbstractContentObject {
                }
                // Restore
                $GLOBALS['TSFE']->currentRecord = $originalRec;
+               if ($originalRec) {
+                       --$GLOBALS['TSFE']->recordRegister[$originalRec];
+               }
                return $theValue;
        }