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 #1

Updated by Benni Mack almost 6 years ago

  • Status changed from New to Needs Feedback

Actually, it does have to be inside "imagefile_ext" in order to have a OnlineMedia helper deal with the rendering.

getFileName() is only working for local files (pre FAL), and since your's is just a point, it does not work. The external image provider needs to hook into the Resource ProcessorInterface.

Actions #2

Updated by Riccardo De Contardi over 5 years ago

  • Status changed from Needs Feedback to Closed

No feedback since the last 90 days => closing this issue.

Moreover, Benni's help will point in you in the right direction on how to solve this issue; if you still think that this is the wrong decision or have more detailed information, please reopen it or open a new issue with a reference to this one.

Also, feel free to join on Slack the #typo3-cms channel. You can register in the TYPO3 slack workspace here: https://forger.typo3.com/slack

Thank you and best regards

Actions

Also available in: Atom PDF