Bug #80749
closedScheduler does not work with ADOdb / SELECT_queryArray passes NULL instead of strings
100%
Description
Hey,
I'm using TYPO3 7.6.16 and PostgreSQL 9.6.2.
Whenever I execute a scheduler task I get an exception
Argument 1 passed to TYPO3\CMS\Dbal\Database\DatabaseConnection::_quoteGroupBy() must be of the type array, string given, called in /typo3_src-7.6.16/typo3/sysext/dbal/Classes/Database/DatabaseConnection.php on line 1876
The reason for this is that the scheduler does not pass all expected parameters to the database method.
»/typo3/sysext/scheduler/Classes/Scheduler.php« (fetchTask, line 269) does pass an array with SELECT, FROM, WHERE and LIMIT to the database method »exec_SELECT_queryArray«.
»/typo3/sysext/core/Classes/Database/DatabaseConnection.php« (queryArray, line 358) uses all possible array keys and passes them to the »exec_SELECTquery« method. If the previous method did not provide one of the keys then »NULL« will be passed instead. In PostgreSQL this will cause the exception shown above.
Solution 1: Pass all possible array keys / parameters in the original method. E.g.
$queryArray = [ 'SELECT' => 'uid, serialized_task_object', 'FROM' => 'tx_scheduler_task', 'WHERE' => 'uid = ' . (int)$uid, 'GROUPBY' => '', 'ORDERBY' => '', 'LIMIT' => 1 ];
Solution 2: We saw, that this error occured several times before, e.g: #76991 Instead of fixing the origin it may be a good idea to fix the »exec_SELECT_queryArray« and make sure, that this one passes all optional keys with a least an empty string. This means, that the method has to check for the existance of the optional keys. E.g.
$queryPartsFallback = [ 'GROUPBY' => '', 'ORDERBY' => '', 'LIMIT' => '' ]; $queryParts = array_merge($queryPartsFallback, $queryParts); return $this->exec_SELECTquery($queryParts['SELECT'], $queryParts['FROM'], $queryParts['WHERE'], $queryParts['GROUPBY'], $queryParts['ORDERBY'], $queryParts['LIMIT']);
The bug appears in 7.6 and 6.2
Updated by Gerrit Code Review over 7 years ago
- Status changed from New to Under Review
Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52386
Updated by Gerrit Code Review over 7 years ago
Patch set 2 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52386
Updated by Gerrit Code Review over 7 years ago
Patch set 3 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52386
Updated by Dan Kleine (Untenzu) over 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset e2c8ffe9da9d5992b9e7296df664c9080c550373.