[BUGFIX] getTreeList must return comma-separated list 26/57026/2
authorGuido Schmechel <littlegee@web.de>
Tue, 13 Mar 2018 20:22:03 +0000 (21:22 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Tue, 22 May 2018 09:40:42 +0000 (11:40 +0200)
While retrieving the list with begin as argument for a
recursive call, getTreeList builds the comma-separated list
correctly.

Resolves: #83328
Releases: master, 8.7, 7.6
Change-Id: I643477dd5c0cbfb67532dd96eb0b479e0cb532b8
Reviewed-on: https://review.typo3.org/57026
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/core/Classes/Database/QueryGenerator.php

index 321cc4e..a2cf178 100644 (file)
@@ -1560,7 +1560,11 @@ class QueryGenerator
                     $theList .= ',' . $row['uid'];
                 }
                 if ($depth > 1) {
-                    $theList .= $this->getTreeList($row['uid'], $depth - 1, $begin - 1, $perms_clause);
+                    $theSubList = $this->getTreeList($row['uid'], $depth - 1, $begin - 1, $perms_clause);
+                    if (!empty($theList) && !empty($theSubList) && ($theSubList[0] !== ',')) {
+                        $theList .= ',';
+                    }
+                    $theList .= $theSubList;
                 }
             }
             $databaseConnection->sql_free_result($res);