From c864190e70096059d123f36a4378cb503aa9286f Mon Sep 17 00:00:00 2001 From: Frank Naegler <frank.naegler@typo3.org> Date: Thu, 16 Feb 2017 18:01:33 +0100 Subject: [PATCH] [BUGFIX] Fix SQL error for single table view in list module This patch fixes wrong field escaping due to simple implode of fields in case label_alt is set for select or groups fields. Resolves: #79860 Releases: master Change-Id: Ie0753957e387c1624824d152ac291524cfd34ccd Reviewed-on: https://review.typo3.org/51721 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Oliver Hader <oliver.hader@typo3.org> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org> Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org> --- .../backend/Classes/Utility/BackendUtility.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index cd57fbfa3dea..9ca18500662c 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -2274,13 +2274,13 @@ class BackendUtility if ($uid) { // Display the title of MM related records in lists if ($noRecordLookup) { - $MMfield = $theColConf['foreign_table'] . '.uid'; + $MMfields = []; + $MMfields[] = $theColConf['foreign_table'] . '.uid'; } else { $MMfields = [$theColConf['foreign_table'] . '.' . $GLOBALS['TCA'][$theColConf['foreign_table']]['ctrl']['label']]; foreach (GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$theColConf['foreign_table']]['ctrl']['label_alt'], true) as $f) { $MMfields[] = $theColConf['foreign_table'] . '.' . $f; } - $MMfield = implode(',', $MMfields); } /** @var $dbGroup RelationHandler */ $dbGroup = GeneralUtility::makeInstance(RelationHandler::class); @@ -2300,7 +2300,7 @@ class BackendUtility ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); $result = $queryBuilder - ->select('uid', $MMfield) + ->select('uid', ...$MMfields) ->from($theColConf['foreign_table']) ->where( $queryBuilder->expr()->in( @@ -2423,7 +2423,8 @@ class BackendUtility if ($uid) { // Display the title of MM related records in lists if ($noRecordLookup) { - $MMfield = $theColConf['foreign_table'] . '.uid'; + $MMfields = []; + $MMfields[] = $theColConf['foreign_table'] . '.uid'; } else { $MMfields = [$theColConf['foreign_table'] . '.' . $GLOBALS['TCA'][$theColConf['foreign_table']]['ctrl']['label']]; $altLabelFields = explode( @@ -2436,7 +2437,6 @@ class BackendUtility $MMfields[] = $theColConf['foreign_table'] . '.' . $f; } } - $MMfield = implode(',', $MMfields); } /** @var $dbGroup RelationHandler */ $dbGroup = GeneralUtility::makeInstance(RelationHandler::class); @@ -2456,7 +2456,7 @@ class BackendUtility ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); $result = $queryBuilder - ->select('uid', $MMfield) + ->select('uid', ...$MMfields) ->from($theColConf['foreign_table']) ->where( $queryBuilder->expr()->in( -- GitLab