[BUGFIX] Add file existence check before processing it 37/32637/2
authorFrank Nägler <typo3@naegler.net>
Fri, 5 Sep 2014 14:16:03 +0000 (16:16 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Mon, 8 Sep 2014 12:40:11 +0000 (14:40 +0200)
This patch adds a check if a file exists before processing it.
If the file does not exist, all file functions will generate a warning.

Resolves: #61300
Releases: 6.3, 6.2
Change-Id: Ie829ec0ade8357b16f8a550d5f137593900720b9
Reviewed-on: http://review.typo3.org/32637
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index 4881acb..9460da3 100644 (file)
@@ -1561,7 +1561,7 @@ class ContentObjectRenderer {
         */
        public function fileResource($fName, $addParams = 'alt="" title=""') {
                $incFile = $GLOBALS['TSFE']->tmpl->getFileName($fName);
-               if ($incFile) {
+               if ($incFile && file_exists($incFile)) {
                        $fileinfo = GeneralUtility::split_fileref($incFile);
                        if (GeneralUtility::inList('jpg,gif,jpeg,png', $fileinfo['fileext'])) {
                                $imgFile = $incFile;