#57043T3 6.2 beta 7: mysqli::query(): Empty query in [...] Database/DatabaseConnection.php line 467
Description
Usage of $query->statement() seems to be broken recently:
$query = parent::createQuery();
$query->statement('SELECT SUM(t.value) AS cash FROM transaction AS t WHERE NOT t.internal AND NOT t.deleted');
$result = $query->execute(true);
return (float) $result[0]['cash'];
Does no more return result but PHP Warning:
PHP Warning: mysqli::query(): Empty query in [...]/typo3/sysext/core/Classes/Database/DatabaseConnection.php line 467
Tracking this down leads to Typo3DbBackend, lines 404 – 415 where the var $sqlString does not get initialized in case of empty parameters. Setting some arbitrary parameters overrides the PHP Warning and fixes output.
/**
* @deprecated since 6.2, this block will be removed in two versions
* the deprecation log is in Qom\Statement
*/
if (!empty($parameters)) {
$sqlString = $statement->getStatement();
$this->replacePlaceholders($sqlString, $parameters);
}
$result = $this->databaseHandle->sql_query($sqlString);
$this->checkSqlErrors();Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.