Actions
Bug #57043
closedT3 6.2 beta 7: mysqli::query(): Empty query in [...] Database/DatabaseConnection.php line 467
Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2014-03-18
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
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();
Actions