[BUGFIX] Outdated resource pointers crash for TCA type group 46/53546/2
authorOliver Hader <oliver@typo3.org>
Wed, 19 Jul 2017 12:26:15 +0000 (14:26 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Mon, 24 Jul 2017 16:33:21 +0000 (18:33 +0200)
Using TCA type "group" with internal_type "folder" crashes in
the backend if existing resource pointers have been moved in
the filesystem (e.g. renamed or deleted).

Resolves: #81918
Releases: master, 8.7, 7.6
Change-Id: I1aadee90d1fe81cd821cc3df594351dbfc101482
Reviewed-on: https://review.typo3.org/53546
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaGroup.php

index 43c87a2..16a4a3d 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Backend\Form\FormDataProvider;
 
 use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
 use TYPO3\CMS\Core\Database\RelationHandler;
+use TYPO3\CMS\Core\Resource\Exception;
 use TYPO3\CMS\Core\Resource\Folder;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -79,12 +80,17 @@ class TcaGroup implements FormDataProviderInterface
                 // Simple list of folders
                 $folderList = GeneralUtility::trimExplode(',', $databaseRowFieldContent, true);
                 foreach ($folderList as $folder) {
-                    if ($folder) {
+                    if (empty($folder)) {
+                        continue;
+                    }
+                    try {
                         $folderObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($folder);
                         if ($folderObject instanceof Folder) {
                             $folderName = PathUtility::basename($folderObject->getIdentifier());
                             $folders[] = rawurlencode($folder) . '|' . rawurlencode($folderName);
                         }
+                    } catch (Exception $exception) {
+                        continue;
                     }
                 }
                 $result['databaseRow'][$fieldName] = implode(',', $folders);