diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index db9eaa8384daecc3c2aedcd0bf59390b65efcc9f..35a5ee99d5abed5b1a8bc0eef2f47da612f3fbbb 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -6707,7 +6707,7 @@ class ContentObjectRenderer implements LoggerAwareInterface $matchEnd = '(\\s*,|\\s*$)/'; $necessaryFields = ['uid', 'pid']; $wsFields = ['t3ver_state']; - if (isset($GLOBALS['TCA'][$table]) && !preg_match($matchStart . '\\*' . $matchEnd, $selectPart) && !preg_match('/(count|max|min|avg|sum)\\([^\\)]+\\)/i', $selectPart)) { + if (isset($GLOBALS['TCA'][$table]) && !preg_match($matchStart . '\\*' . $matchEnd, $selectPart) && !preg_match('/(count|max|min|avg|sum)\\([^\\)]+\\)|distinct/i', $selectPart)) { foreach ($necessaryFields as $field) { $match = $matchStart . $field . $matchEnd; if (!preg_match($match, $selectPart)) { diff --git a/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php index c860e4eb06f7eaabfc1f6e18d954623c173fd154..57cfe1d3a964195cef1a077980f3b52609385f1b 100644 --- a/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php +++ b/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php @@ -180,6 +180,15 @@ class ContentObjectRendererTest extends FunctionalTestCase [ 'SELECT' => 'avg(crdate)' ] + ], + 'single distinct, add nothing' => [ + 'tt_content', + [ + 'selectFields' => 'DISTINCT crdate' + ], + [ + 'SELECT' => 'DISTINCT crdate' + ] ] ];