[BUGFIX] Catch some FAL exceptions for missing driver 23/44523/2
authorNicole Cordes <typo3@cordes.co>
Tue, 3 Nov 2015 22:24:51 +0000 (23:24 +0100)
committerAlexander Opitz <opitz.alexander@googlemail.com>
Wed, 4 Nov 2015 09:36:56 +0000 (10:36 +0100)
If a driver of a storage isn't available anymore (e.g. because an
extension was deactivated), an exception is thrown and the backend
stops working on multiple sites.

This patch catches the InvalidArgumentException which is thrown by the
DriverRegistry and ensures a proper working mode. The exception is
caught when:

- editing a record with inline record to a file of that storage
- editing a record with image manipulation of a file of that storage
- opening the element browser where the last folder was within that storage

Resolves: #71296
Releases: master
Change-Id: Ide83d411ab6c0e1850ff9cb9eec894753e73727f
Reviewed-on: https://review.typo3.org/44523
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php
typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php
typo3/sysext/recordlist/Classes/Browser/FileBrowser.php

index 498702e..2e8e63e 100644 (file)
@@ -351,7 +351,11 @@ class InlineRecordContainer extends AbstractContainer
             $fileUid = array_pop(BackendUtility::splitTable_Uid($firstElement));
 
             if (!empty($fileUid)) {
-                $fileObject = ResourceFactory::getInstance()->getFileObject($fileUid);
+                try {
+                    $fileObject = ResourceFactory::getInstance()->getFileObject($fileUid);
+                } catch (\InvalidArgumentException $e) {
+                    $fileObject = null;
+                }
                 if ($fileObject && $fileObject->isMissing()) {
                     $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
                     $thumbnail = $flashMessage->render();
index 67cdb3b..38a3956 100644 (file)
@@ -174,6 +174,7 @@ class ImageManipulationElement extends AbstractFormElement
             try {
                 $file = ResourceFactory::getInstance()->getFileObject($fileUid);
             } catch (FileDoesNotExistException $e) {
+            } catch (\InvalidArgumentException $e) {
             }
         }
         return $file;
index 5f2441a..6ee2b45 100644 (file)
@@ -135,6 +135,8 @@ class FileBrowser extends AbstractElementBrowser implements ElementBrowserInterf
                 $fileOrFolderObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->expandFolder);
             } catch (Exception $accessException) {
                 // We're just catching the exception here, nothing to be done if folder does not exist or is not accessible.
+            } catch (\InvalidArgumentException $driverMissingExecption) {
+                // We're just catching the exception here, nothing to be done if the driver does not exist anymore.
             }
 
             if ($fileOrFolderObject instanceof Folder) {