Project

General

Profile

Bug #80749

Updated by Dan Kleine (Untenzu) about 7 years ago

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.  

 <pre> 
             $queryArray = [ 
                 'SELECT' => 'uid, serialized_task_object', 
                 'FROM' => 'tx_scheduler_task', 
                 'WHERE' => 'uid = ' . (int)$uid, 
                 'GROUPBY' => '', 
                 'ORDERBY' => '', 
                 'LIMIT' => 1 
             ]; 

 </pre> 

 Solution 2: We saw, that this error errors 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. 

 <pre> 
         $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']); 
 </pre> 

 The bug appears in 7.6 and 6.2

Back