Project

General

Profile

Actions

Bug #85154

closed

\TYPO3\CMS\Core\TypoScript\TemplateService::getFileName throws PHP Warning if a FileReference is passed which points to a file which is not registered as an 'imagefile_ext'

Added by Grigori Prokhorov almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2018-06-04
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

\TYPO3\CMS\Core\TypoScript\TemplateService::getFileName throws PHP Warning if a FileReference is passed which points to a file which is not registered as an 'imagefile_ext'.

The error occurs in a case when there are files present which have a special format which is not (by default) included in $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'].

This situation occurs if you consider a setup like:

  • The TYPO3 instance uses an external image provider
  • Images are inserted into TYPO3 by creating a new File (in e.g. the page properties media field) by inputting a file-ID.
  • This file gets created in the fileadmin with a special extension (e.g. .mediapool) and later processed in an API-call or the like.

If this extension is not added to the imagefile_ext-list, \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getImgResource does NOT try to apply the $processingConfiguration (which would be futile in such a case anyway as firstly there's no processing configuration set, secondly no processing is possible since the file is basically just a pointer), which in turn leads to the condition on typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:5039 to succeed, thus passing the $file variable to \TYPO3\CMS\Core\TypoScript\TemplateService::getFileName.

On development systems this results in a PHP Warning being thrown as an Exception, breaking the FE output.

Proposed solution would be to add an additional check to \TYPO3\CMS\Core\TypoScript\TemplateService::getFileName before calling trim to exit the method it the passed fileFromSetup variable is a File or FileReference.

Actions

Also available in: Atom PDF