[BUGFIX] Use early return in cObj::getImgResource 62/38162/3
authorOliver Hader <oliver@typo3.org>
Wed, 25 Mar 2015 13:43:36 +0000 (14:43 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Wed, 25 Mar 2015 23:31:38 +0000 (00:31 +0100)
If ContentObjectRenderer::getImgResource is called without any
data, there is no need to execute all possibilities and lookup
files with an empty identifier.
For instance TextMenuContentObject::getBeforeAfter triggers
this at lot.

Resolves: #66028
Releases: master, 6.2
Change-Id: Iee7a3ce0f2956cd6ddae8c2e3d194f3cf2855c49
Reviewed-on: http://review.typo3.org/38162
Reviewed-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
Tested-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index 7a9364b..9bb317a 100644 (file)
@@ -5421,6 +5421,9 @@ class ContentObjectRenderer {
         * @see IMG_RESOURCE(), cImage(), \TYPO3\CMS\Frontend\Imaging\GifBuilder
         */
        public function getImgResource($file, $fileArray) {
+               if (empty($file) && empty($fileArray)) {
+                       return NULL;
+               }
                if (!is_array($fileArray)) {
                        $fileArray = (array)$fileArray;
                }