[BUGFIX] sql_free_result does not work with all allowed types 94/22594/3
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:22:02 +0000 (01:22 +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/22594
Reviewed-by: Dan Untenzu
Tested-by: Dan Untenzu
Reviewed-by: Christian Kuhn
Reviewed-by: Stefan Neufeind
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/core/Classes/Database/DatabaseConnection.php

index cc8b97f..ebdcc74 100644 (file)
@@ -769,7 +769,7 @@ class DatabaseConnection {
         *
         * @param string $query The query to execute
         * @param array $queryComponents The components of the query to execute
-        * @return \mysqli_statement|object MySQLi statement / DBAL object
+        * @return \mysqli_stmt|object MySQLi statement / DBAL object
         * @internal This method may only be called by \TYPO3\CMS\Core\Database\PreparedStatement
         */
        public function prepare_PREPAREDquery($query, array $queryComponents) {
@@ -1081,7 +1081,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;