From 3b86ba556219921a5700217b3c25dedde8d6b0db Mon Sep 17 00:00:00 2001
From: Marc Bastian Heinrichs <typo3@mbh-software.de>
Date: Thu, 22 May 2014 10:32:03 +0200
Subject: [PATCH] [BUGFIX] Catch all errors on adding files of sys_files to
 export
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Adding files from sys_file records is not robust enough. For example
sys_file records could exist for already deleted files. In this case a
RuntimeException is thrown, which is not caught currently.

Solution: catch all Exceptions thrown from Resources in
export_addSysFile and report them to the user.

Resolves: #59015
Releases: master, 6.2
Change-Id: If7ce51a2ae756b43dc30d5545b076310972342f4
Reviewed-on: http://review.typo3.org/30318
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Stephan Großberndt <stephan@grossberndt.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
---
 typo3/sysext/impexp/Classes/ImportExport.php | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/typo3/sysext/impexp/Classes/ImportExport.php b/typo3/sysext/impexp/Classes/ImportExport.php
index 4e3fcf733f53..91451c78632b 100644
--- a/typo3/sysext/impexp/Classes/ImportExport.php
+++ b/typo3/sysext/impexp/Classes/ImportExport.php
@@ -1042,12 +1042,8 @@ class ImportExport {
 			} else {
 				$file->checkActionPermission('read');
 			}
-
-		} catch (\TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException $e) {
-			$this->error('File ' . $file->getPublicUrl() . ': ' . $e->getMessage());
-			return;
-		} catch (\TYPO3\CMS\Core\Resource\Exception\IllegalFileExtensionException $e) {
-			$this->error('File ' . $file->getPublicUrl() . ': ' . $e->getMessage());
+		} catch (\Exception $e) {
+			$this->error('Error when trying to add file ' . $file->getCombinedIdentifier() . ': ' . $e->getMessage());
 			return;
 		}
 		$fileUid = $file->getUid();
-- 
GitLab