Issue Bug Closed

#61229Missing check in PreparedStatement

Jacob Rasmussen 08/27/14, 17:32 updated 10/02/18, 11:52

Description

If the prepared statement class is used for inserts or updates, the persistence class will trigger a fatal error, as there are no fields in the result set.

A simple fix is needed in the execute method

@@ -363,8 +364,10 @@ class PreparedStatement {
                        // Store the list of fields
                        if ($this->statement instanceof \mysqli_stmt) {
                                $result = $this->statement->result_metadata();
-                               $fields = $result->fetch_fields();
-                               $result->close();
+                               if ($result instanceof \mysqli_result) {
+                                       $fields = $result->fetch_fields();
+                                       $result->close();
+                               }
                        } else {

I will send a patch for TYPO3 6.2 to gerrit shortly

Reviews 2