[BUGFIX] Fix bug due to improper usage of boolean as object 35/52435/6
authorsven_carstens <sv3n.carst3ns@gmail.com>
Tue, 11 Apr 2017 13:44:21 +0000 (15:44 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 16 Apr 2017 20:07:42 +0000 (22:07 +0200)
\Doctrine\DBAL\Statement returns a boolean from calls to the execute() method.
To get the results of the query we obviously can't use that and must use the
original instance of \Doctrine\DBAL\Statement in $realStatement.

Resolves: #80781
Releases: master
Change-Id: If1443a9c519bf2fddf7e3983f4b740ea025b3c2d
Reviewed-on: https://review.typo3.org/52435
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Manuel Selbach <manuel_selbach@yahoo.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>

index 669bcbb..cbe3a0b 100644 (file)
@@ -374,11 +374,11 @@ class Typo3DbBackend implements BackendInterface, SingletonInterface
             $rows = $result->fetchAll();
         } elseif ($realStatement instanceof \Doctrine\DBAL\Statement) {
             try {
-                $result = $realStatement->execute($parameters);
+                $realStatement->execute($parameters);
             } catch (DBALException $e) {
                 throw new SqlErrorException($e->getPrevious()->getMessage(), 1481281404);
-            $rows = $result->fetchAll();
+            $rows = $realStatement->fetchAll();
         } elseif ($realStatement instanceof \TYPO3\CMS\Core\Database\PreparedStatement) {
             GeneralUtility::deprecationLog('Extbase support for Prepared Statements has been deprecated in TYPO3 v8, and will be removed in TYPO3 v9. Use native Doctrine DBAL Statements or QueryBuilder objects.');