Issue Bug Closed

#87557Invalid database result with sql_free_result

Franz Holzinger 01/28/19, 08:19 updated 01/28/19, 14:55

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;
        }

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.