Issue Bug Closed

#72414FrontendConfigurationManager::overrideStoragePidIfStartingPointIsSet() ignores empty String response from getTreeList()

Jan Starke 12/23/15, 12:59 updated 10/21/17, 17:46

Description

getTreeList() normally returns a comma separated List of PIDs, but it may also return an empty String (if no corresponding pages are found). In such a case, FrontendConfigurationManager::overrideStoragePidIfStartingPointIsSet() simply appends that empty string to $list (line 125 in FrontendConfigurationManager.php).

Some lines below, this empty String is imploded and appended to $pages, which in my case creates an array with the content “47,”. The comma after 47 is the result of
@$pages = $pages . ‘,’ . implode(‘,’, $list);@
with $list being an empty String

I suggest the following fix:

123                 $explodedPages = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $pages);
124                 foreach ($explodedPages as $pid) {
125                     $pidList = $this->contentObject->getTreeList($pid, $this->contentObject->data['recursive']);
126                     if ($pidList) {
127                       array_push($list, $pidList);
128                     }
129                 }
130             }
131             if (!empty($list)) {
132                 $pages = $pages . ',' . implode(',', $list);
133             }

Kind regards, Jan

Reviews 3