[BUGFIX] Follow up: Remove PHP warnings when no icon is found 03/32803/3
authorNicole Cordes <typo3@cordes.co>
Tue, 16 Sep 2014 13:02:08 +0000 (15:02 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 16 Sep 2014 13:41:49 +0000 (15:41 +0200)
With https://review.typo3.org/32616/ a check with file_exists() was
introduced to prevent warnings on accessing non-image files. The check
returns true for files and folders. Now warnings are thrown, if an image
icon links to a folder. This patch replaces file_exists() with is_file()
to prevent further warnings.

Resolves: #61640
Releases: 6.3, 6.2
Change-Id: If2f7db44588d7fb9f90d05fb3192653002fe0202
Reviewed-on: http://review.typo3.org/32803
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
Tested-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Form/FormEngine.php

index 0ed112c..84bc4b0 100644 (file)
@@ -4770,18 +4770,18 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                        }
                } elseif (substr($icon, 0, 3) == '../') {
                        $selIconFile = $this->backPath . GeneralUtility::resolveBackPath($icon);
-                       if (file_exists(PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3)))) {
+                       if (is_file(PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3)))) {
                                $selIconInfo = getimagesize((PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3))));
                        }
                } elseif (substr($icon, 0, 4) == 'ext/' || substr($icon, 0, 7) == 'sysext/') {
                        $selIconFile = $this->backPath . $icon;
-                       if (file_exists(PATH_typo3 . $icon)) {
+                       if (is_file(PATH_typo3 . $icon)) {
                                $selIconInfo = getimagesize(PATH_typo3 . $icon);
                        }
                } else {
                        $selIconFile = IconUtility::skinImg($this->backPath, 'gfx/' . $icon, '', 1);
                        $iconPath = substr($selIconFile, strlen($this->backPath));
-                       if (file_exists(PATH_typo3 . $iconPath)) {
+                       if (is_file(PATH_typo3 . $iconPath)) {
                                $selIconInfo = getimagesize(PATH_typo3 . $iconPath);
                        }
                }