[FOLLOWUP][BUGFIX] ImageViewHelper should catch exceptions 70/45170/3
authorAndreas Allacher <andreas@allacher.com>
Mon, 7 Dec 2015 09:57:36 +0000 (10:57 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Tue, 8 Dec 2015 05:23:07 +0000 (06:23 +0100)
We also need to catch RuntimeException and InvalidArgumentException.
InvalidArgumentException might be thrown if a storage does not exist.
RuntimeException if a file is outside a storage.

Change-Id: I994d8e7ef8b515f23ccc01847cefac0202f14b6f
Releases: master, 6.2
Resolves: #71686
Reviewed-on: https://review.typo3.org/45170
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/fluid/Classes/ViewHelpers/ImageViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Uri/ImageViewHelper.php

index e1a1dad..1508347 100644 (file)
@@ -130,7 +130,13 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedV
                                $this->tag->addAttribute('title', $title);
                        }
                } catch (ResourceDoesNotExistException $e) {
+                       // thrown if file does not exist
                } catch (\UnexpectedValueException $e) {
+                       // thrown if a file has been replaced with a folder
+               } catch (\RuntimeException $e) {
+                       // RuntimeException thrown if a file is outside of a storage
+               } catch (\InvalidArgumentException $e) {
+                       // thrown if file storage does not exist
                }
 
                return $this->tag->render();
index 3a7ebad..86016f6 100644 (file)
@@ -96,7 +96,13 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelpe
                        $processedImage = $this->imageService->applyProcessingInstructions($image, $processingInstructions);
                        return $this->imageService->getImageUri($processedImage);
                } catch (ResourceDoesNotExistException $e) {
+                       // thrown if file does not exist
                } catch (\UnexpectedValueException $e) {
+                       // thrown if a file has been replaced with a folder
+               } catch (\RuntimeException $e) {
+                       // RuntimeException thrown if a file is outside of a storage
+               } catch (\InvalidArgumentException $e) {
+                       // thrown if file storage does not exist
                }
                return '';
        }