[BUGFIX] Prevent warning in Upgrade Wizard 12/37012/5
authorNicole Cordes <typo3@cordes.co>
Thu, 19 Feb 2015 08:16:05 +0000 (09:16 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Thu, 19 Feb 2015 09:14:43 +0000 (10:14 +0100)
The ReferenceIntegrityUpdateWizard looks for existing FAL file references.
If you start the Upgrade Wizard without any database update before, FAL
tables don't exists yet and the database request returns a non array
value. As the Wizard expects an array to be returned without proper
casting, a warning is thrown.

Releases: 6.2
Resolves: #65159
Change-Id: Ib4e6c308d1e2de8e7f7e2523d62a4ff97ef47bb5
Reviewed-on: http://review.typo3.org/37012
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Stephan GroƟberndt <stephan@grossberndt.de>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/install/Classes/Updates/ReferenceIntegrityUpdateWizard.php

index 6105646..3b9b6c3 100644 (file)
@@ -119,14 +119,20 @@ class ReferenceIntegrityUpdateWizard extends AbstractUpdate {
        /**
         * Fetches a list of all sys_file_references that have PID=0
         *
-        * @return mixed
+        * @return array
         */
        protected function getFileReferencesOnRootlevel() {
-               return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+               $fileReferences = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
                        'uid, pid, uid_local AS fileuid, uid_foreign AS targetuid, tablenames AS targettable',
                        'sys_file_reference',
                        'pid=0 AND deleted=0'
                );
+               if (!is_array($fileReferences)) {
+                       // An SQL error occurred, most likely because the sys_file_reference table is not there.
+                       // We ignore this here to avoid a warning when initially showing the upgrade wizard (see #65159).
+                       return array();
+               }
+               return $fileReferences;
        }
 
        /**