Project

General

Profile

Actions

Bug #61229

closed

Missing check in PreparedStatement

Added by Jacob Rasmussen over 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
Start date:
2014-08-27
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

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

Actions

Also available in: Atom PDF