Bug #50378
closedsql_free_result does not work with all parameters as specified
100%
Description
The method "sql_free_result" of the DatabaseConnection class throws a fatal error when called with the (boolean) result of exec_INSERTquery.
The direct mail extension uses the following code:
$res = $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_dmail_maillog', $insertFields); $GLOBALS['TYPO3_DB']->sql_free_result($res);
This results in a fatal error because $res is boolean true and sql_free_result asumes it is an object.
The method description of sql_free_result says that it is ok, to call the method with a boolean:
* @param boolean|\mysqli_result|object $res MySQLi result object / DBAL object
The fix would be to check if the parameter is an object before calling the free-method.
Another "fix" would be to change the method description, but that would leave bugs in extensions which relied on the ability to call sql_free_result with boolean results.
Note: In TYPO3 4.7 sql_free_result would just call mysql_free_result, which would not throw a fatal error, when called with a boolean parameter, but just return false.