diff -ru typo3_src-4.3.2.original/t3lib/class.t3lib_tstemplate.php typo3_src-4.3.2/t3lib/class.t3lib_tstemplate.php --- typo3_src-4.3.2.original/t3lib/class.t3lib_tstemplate.php 2010-02-23 12:00:03.000000000 +0100 +++ typo3_src-4.3.2/t3lib/class.t3lib_tstemplate.php 2010-02-25 22:45:05.000000000 +0100 @@ -571,19 +571,15 @@ $GLOBALS['TYPO3_DB']->sql_free_result($res); } } else { // NORMAL OPERATION: - $basedOnArr = t3lib_div::intExplode(',', $row['basedOn']); - foreach ($basedOnArr as $id) { // traversing list - if (!t3lib_div::inList($idList,'sys_'.$id)) { // if $id is not allready included ... - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_template', 'uid='.intval($id).' '.$this->whereClause); - if ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // there was a template, then we fetch that - $this->versionOL($subrow); - if (is_array($subrow)) { - $this->processTemplate($subrow,$idList.',sys_'.$id,$pid, 'sys_'.$id,$templateID); - } - } - $GLOBALS['TYPO3_DB']->sql_free_result($res); - } + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_template', 'uid in ('.$row['basedOn'].') '.$this->whereClause, '', 'FIELD(uid, '.$row['basedOn'].')'); + while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { + if (t3lib_div::inList($idList,'sys_'.$subrow[$uid])) continue; //skip template if already included + $this->versionOL($subrow); + if (is_array($subrow)) { + $this->processTemplate($subrow,$idList.',sys_'.$subrow[$uid],$pid, 'sys_'.$subrow[$uid],$templateID); + } } + $GLOBALS['TYPO3_DB']->sql_free_result($res); } }