Fixed bug #16110: stdWrap functions stop working as soon as there is one conditional...
authorSusanne Moog <typo3@susannemoog.de>
Sat, 23 Oct 2010 15:30:27 +0000 (15:30 +0000)
committerSusanne Moog <typo3@susannemoog.de>
Sat, 23 Oct 2010 15:30:27 +0000 (15:30 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9195 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/tslib/class.tslib_content.php

index 43a8e14..ec0fef2 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-10-23  Susanne Moog  <typo3@susanne-moog.de>
+
+       * Fixed bug #16110: stdWrap functions stop working as soon as there is one conditional function returning false (Thanks to Jo Hasenau)
+
 2010-10-22  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Added feature #16114: htmlArea RTE: cleanup some js code generation code
index 7a64877..675c69e 100644 (file)
@@ -4423,12 +4423,15 @@ class tslib_cObj {
                        $isExecuted = array();
                        // additional switch to make sure 'required', 'if' and 'fieldRequired'
                        // will still stop rendering immediately in case they return false
-                       $this->stopRendering = false;
+
+                       $this->stdWrapRecursionLevel++;
+                       $this->stopRendering[$this->stdWrapRecursionLevel] = false;
 
                        // execute each funtion in the predefined order
                        foreach ($sortedConf as $stdWrapName => $enabled) {
+
                                // eliminate the second key of a pair 'key'|'key.' to make sure functions get called only once and check if rendering has been stopped
-                               if (!$isExecuted[$stdWrapName] && !$this->stopRendering) {
+                               if (!$isExecuted[$stdWrapName] && !$this->stopRendering[$this->stdWrapRecursionLevel]) {
                                        $functionName = rtrim($stdWrapName, '.');
                                        $functionProperties = $functionName . '.';
                                        // if there is any code one the next level, check if it contains "official" stdWrap functions
@@ -4470,6 +4473,9 @@ class tslib_cObj {
                                                );
                                        }
                                }
+
+                               unset($this->stopRendering[$this->stdWrapRecursionLevel]);
+                               $this->stdWrapRecursionLevel--;
                        }
                }
                return $content;
@@ -4774,7 +4780,7 @@ class tslib_cObj {
        public function stdWrap_required($content = '', $conf = array()) {
                if ((string) $content == '') {
                        $content = '';
-                       $this->stopRendering = TRUE;
+                       $this->stopRendering[$this->stdWrapRecursionLevel] = TRUE;
                }
                return $content;
        }
@@ -4791,7 +4797,7 @@ class tslib_cObj {
        public function stdWrap_if($content = '', $conf = array()) {
                if (!$this->checkIf($conf['if.'])) {
                        $content = '';
-                       $this->stopRendering = TRUE;
+                       $this->stopRendering[$this->stdWrapRecursionLevel] = TRUE;
                }
                return $content;
        }
@@ -4808,7 +4814,7 @@ class tslib_cObj {
        public function stdWrap_fieldRequired($content = '', $conf = array()) {
                if (!trim($this->data[$conf['fieldRequired']])) {
                        $content = '';
-                       $this->stopRendering = TRUE;
+                       $this->stopRendering[$this->stdWrapRecursionLevel] = TRUE;
                }
                return $content;
        }