[BUGFIX] INTincScript_process: array check too late
authorBjoern Pedersen <bjoern.pedersen@frm2.tum.de>
Mon, 8 Aug 2011 11:20:28 +0000 (13:20 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Mon, 22 Aug 2011 20:17:27 +0000 (22:17 +0200)
The array check for the configuration has been moved before
the first usage.

Change-Id: Ia1355206b2a2e7bdc1cfa9b15402abb2ef3f36d5
Resolves: #28833
Releases: 4.6
Reviewed-on: http://review.typo3.org/4215
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
typo3/sysext/cms/tslib/class.tslib_fe.php

index ad2d0b3..a70f572 100644 (file)
         * @return      void
         * @see         INTincScript()
         */
-       protected function INTincScript_process($INTiS_config)  {
+       protected function INTincScript_process($INTiS_config) {
                $GLOBALS['TT']->push('Split content');
-               $INTiS_splitC = explode('<!--INT_SCRIPT.',$this->content);                      // Splits content with the key.
+                       // Splits content with the key.
+               $INTiS_splitC = explode('<!--INT_SCRIPT.', $this->content);
                $this->content = '';
-               $GLOBALS['TT']->setTSlogMessage('Parts: '.count($INTiS_splitC));
+               $GLOBALS['TT']->setTSlogMessage('Parts: ' . count($INTiS_splitC));
                $GLOBALS['TT']->pull();
 
-               foreach($INTiS_splitC as $INTiS_c => $INTiS_cPart)      {
-                       if (substr($INTiS_cPart,32,3)=='-->')   {       // If the split had a comment-end after 32 characters it's probably a split-string
-                               $INTiS_key = 'INT_SCRIPT.'.substr($INTiS_cPart,0,32);
-                               $GLOBALS['TT']->push('Include '.$INTiS_config[$INTiS_key]['file'],'');
-                               $incContent='';
-                               if (is_array($INTiS_config[$INTiS_key]))        {
+               foreach($INTiS_splitC as $INTiS_c => $INTiS_cPart) {
+                               // If the split had a comment-end after 32 characters it's probably a split-string
+                       if (substr($INTiS_cPart, 32, 3) === '-->') {
+                               $INTiS_key = 'INT_SCRIPT.' . substr($INTiS_cPart, 0, 32);
+                               if (is_array($INTiS_config[$INTiS_key])) {
+                                       $GLOBALS['TT']->push('Include ' . $INTiS_config[$INTiS_key]['file'], '');
+                                       $incContent = '';
                                        $INTiS_cObj = unserialize($INTiS_config[$INTiS_key]['cObj']);
-                                       /* @var $INTiS_cObj tslib_cObj */
-                                       $INTiS_cObj->INT_include=1;
-                                       switch($INTiS_config[$INTiS_key]['type'])       {
+                                               /* @var $INTiS_cObj tslib_cObj */
+                                       $INTiS_cObj->INT_include = 1;
+                                       switch($INTiS_config[$INTiS_key]['type']) {
                                                case 'SCRIPT':
                                                        $incContent = $INTiS_cObj->PHP_SCRIPT($INTiS_config[$INTiS_key]['conf']);
                                                break;
                                                        $incContent = $INTiS_cObj->USER($INTiS_config[$INTiS_key]['conf']);
                                                break;
                                                case 'POSTUSERFUNC':
-                                                       $incContent = $INTiS_cObj->callUserFunction($INTiS_config[$INTiS_key]['postUserFunc'], $INTiS_config[$INTiS_key]['conf'], $INTiS_config[$INTiS_key]['content']);
+                                                       $incContent = $INTiS_cObj->callUserFunction(
+                                                               $INTiS_config[$INTiS_key]['postUserFunc'],
+                                                               $INTiS_config[$INTiS_key]['conf'],
+                                                               $INTiS_config[$INTiS_key]['content']
+                                                       );
                                                break;
                                        }
+                                       $this->content .= $this->convOutputCharset($incContent, 'INC-' . $INTiS_c);
+                                       $this->content .= substr($INTiS_cPart, 35);
+                                       $GLOBALS['TT']->pull($incContent);
+                               } else {
+                                       $this->content .= substr($INTiS_cPart, 35);
                                }
-                               $this->content.= $this->convOutputCharset($incContent,'INC-'.$INTiS_c);
-                               $this->content.= substr($INTiS_cPart,35);
-                               $GLOBALS['TT']->pull($incContent);
                        } else {
-                               $this->content.= ($INTiS_c?'<!--INT_SCRIPT.':'').$INTiS_cPart;
+                               $this->content .= ($INTiS_c ? '<!--INT_SCRIPT.' : '') . $INTiS_cPart;
                        }
                }
        }
@@ -4767,4 +4775,4 @@ if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLA
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/class.tslib_fe.php']);
 }
 
-?>
+?>
\ No newline at end of file