[BUGFIX] sql_free_result does not work with all allowed types 13/29413/2
authorWouter Wolters <typo3@wouterwolters.nl>
Fri, 26 Jul 2013 14:35:18 +0000 (16:35 +0200)
committerMarkus Klein <klein.t3@mfc-linz.at>
Fri, 11 Apr 2014 23:29:04 +0000 (01:29 +0200)
sql_free_result throws a fatal error when called with a
boolean. According to the method description boolean is an
allowed type. Check if $res is an object.

Change-Id: I6f7cdbb42c07869a320510e9b0b779f2b7cf6b70
Resolves: #50378
Releases: 6.2, 6.1
Reviewed-on: https://review.typo3.org/29413
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/core/Classes/Database/DatabaseConnection.php

index 0bcc47b..e4c2630 100644 (file)
@@ -1071,7 +1071,7 @@ class DatabaseConnection {
         * @return boolean Returns TRUE on success or FALSE on failure.
         */
        public function sql_free_result($res) {
-               if ($this->debug_check_recordset($res)) {
+               if ($this->debug_check_recordset($res) && is_object($res)) {
                        return $res->free();
                } else {
                        return FALSE;