[BUGFIX] DBAL admin_query() check array before accessing it 06/33006/2
authorMarkus Klein <klein.t3@reelworx.at>
Sun, 28 Sep 2014 13:59:09 +0000 (15:59 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 28 Sep 2014 20:46:12 +0000 (22:46 +0200)
Move the $parsedQuery array access after the is_array() check in
DatabaseConnection::admin_query() to avoid PHP warnings.

Releases: master, 6.2
Resolves: #61929
Change-Id: I641d1e0d1dbe0001bd7082fbed1ce5ddb35172f8
Reviewed-on: http://review.typo3.org/33006
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/dbal/Classes/Database/DatabaseConnection.php

index f0ac436..6cbbf2f 100644 (file)
@@ -2862,10 +2862,10 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
         */
        public function admin_query($query) {
                $parsedQuery = $this->SQLparser->parseSQL($query);
-               $ORIG_table = $parsedQuery['TABLE'];
                if (!is_array($parsedQuery)) {
                        throw new \InvalidArgumentException('ERROR: Query could not be parsed: "' . htmlspecialchars($parsedQuery) . '". Query: "' . htmlspecialchars($query) . '"', 1310027793);
                }
+               $ORIG_table = $parsedQuery['TABLE'];
                // Process query based on type:
                switch ($parsedQuery['type']) {
                        case 'CREATETABLE':