Actions
Bug #72850
closedforeach error in DatabaseTreeDataProvider
Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-01-20
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
Description
The foreach loop in /typo3_src-7.6.2/typo3/sysext/core/Classes/Tree/TableConfiguration/DatabaseTreeDataProvider.php raises a PHP error when no record has been found.
Add the check if not empty.
protected function listFieldQuery($fieldName, $queryId) { $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', $this->getTableName(), $GLOBALS['TYPO3_DB']->listQuery($fieldName, (int)$queryId, $this->getTableName()) . ((int)$queryId === 0 ? ' OR CAST(' . $fieldName . ' AS CHAR) = \'\'' : '')); $uidArray = array(); if (!empty($records)) { foreach ($records as $record) { $uidArray[] = $record['uid']; } } return $uidArray; }
Actions