[BUGFIX] MySQLi: FALSE not NULL from sql_fetch()/fetch_row() 73/19473/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 31 Mar 2013 20:19:48 +0000 (22:19 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 31 Mar 2013 20:27:47 +0000 (22:27 +0200)
MySQL previously returned FALSE if there were no more rows.
MySQLi returns NULL. So we'll need to turn that into FALSE
again not to break things.

Fixes: #46824
Releases: 6.1
Change-Id: Ia3f6e32ac71b9cec216459b66b42c7d9526671dd
Reviewed-on: https://review.typo3.org/19473
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Classes/Database/DatabaseConnection.php

index 75d23c8..5b0c22d 100644 (file)
@@ -953,7 +953,12 @@ class DatabaseConnection {
         */
        public function sql_fetch_assoc($res) {
                if ($this->debug_check_recordset($res)) {
-                       return $res->fetch_assoc();
+                       $result = $res->fetch_assoc();
+                       if ($result === NULL) {
+                               // Needed for compatibility
+                               $result = FALSE;
+                       }
+                       return $result;
                } else {
                        return FALSE;
                }
@@ -970,7 +975,12 @@ class DatabaseConnection {
         */
        public function sql_fetch_row($res) {
                if ($this->debug_check_recordset($res)) {
-                       return $res->fetch_row();
+                       $result = $res->fetch_row();
+                       if ($result === NULL) {
+                               // Needed for compatibility
+                               $result = FALSE;
+                       }
+                       return $result;
                } else {
                        return FALSE;
                }