Bug #87557
Invalid database result with sql_free_result
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-01-28
Due date:
% Done:
90%
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
After executing a wrong SQL message I get a PHP error:
bugfix error message: Invalid database result detected: function TYPO3\CMS\Core\Database\DatabaseConnection->sql_free_result
public function exec_SELECTgetRows($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy = '', $limit = '', $uidIndexField = '') { $this->logDeprecation(); $res = $this->exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy, $orderBy, $limit); if ($this->sql_error()) { $this->sql_free_result($res); return null; }
Fix:
/typo3_src-8.7.15/typo3/sysext/core/Classes/Database/DatabaseConnection.php:
if ($this->sql_error()) { if ($res !== false) { $this->sql_free_result($res); } return null; }
History
#1
Updated by Franz Holzinger 11 months ago
Most probably the if can be omitted. There won't be any records to free their space if an SQL error did occur.
This solution should work also:
https://github.com/franzholz/debug_mysql_db/commit/944c39afc9cb125f7ed60e8029e8dbe9f7c87b8e
#2
Updated by Georg Ringer 11 months ago
- Status changed from New to Closed
Thanks for creating the issue! v8 is in important bugfixing phase only. As Doctrine is used in core now I would propose that you create an issue/PR at https://github.com/FriendsOfTYPO3/typo3db_legacy