[BUGFIX] TCE: error message if no label has been set in TCA
authorMario Rimann <typo3-coding@rimann.org>
Tue, 29 Nov 2011 21:46:51 +0000 (22:46 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 19 Feb 2012 14:42:50 +0000 (15:42 +0100)
Avoids an invalid SQL query if no label column is specified by the
TCA for a certain table.

Change-Id: I90211a6bbcbd00a8f0fda25c68c99a1aba3f8a1a
Fixes: #17947
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/6992
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/class.t3lib_befunc.php

index 2c140a3..37577ac 100644 (file)
@@ -2249,7 +2249,9 @@ final class t3lib_BEfunc {
         */
        public static function getCommonSelectFields($table, $prefix = '', $fields = array()) {
                $fields[] = $prefix . 'uid';
-               $fields[] = $prefix . $GLOBALS['TCA'][$table]['ctrl']['label'];
+               if (isset($GLOBALS['TCA'][$table]['ctrl']['label']) && $GLOBALS['TCA'][$table]['ctrl']['label'] != '') {
+                       $fields[] = $prefix . $GLOBALS['TCA'][$table]['ctrl']['label'];
+               }
 
                if ($GLOBALS['TCA'][$table]['ctrl']['label_alt']) {
                        $secondFields = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['label_alt'], 1);