[BUGFIX] Catch all errors on adding files of sys_files to export 18/30318/5
authorMarc Bastian Heinrichs <typo3@mbh-software.de>
Thu, 22 May 2014 08:32:03 +0000 (10:32 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 5 Mar 2015 19:48:25 +0000 (20:48 +0100)
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

index 4e3fcf7..91451c7 100644 (file)
@@ -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();