Project

General

Profile

Actions

Bug #102820

open

directImageLink without imagemagick or gm leads to Error: Object of class TYPO3\CMS\Core\Resource\FileReference could not be converted to string

Added by Jonas Götze 11 months ago. Updated 4 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Image Generation / GIFBUILDER
Target version:
-
Start date:
2024-01-11
Due date:
% Done:

0%

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

Description

When setting the Typoscript setting
lib.contentElement.settings.media.popup.directImageLink = 1
in an instance where no imagemagick or gm is available an error occurs in frontend (TYPO3 12):

Object of class TYPO3\CMS\Core\Resource\FileReference could not be converted to string

or for TYPO3 11:

trim(): Argument #1 ($string) must be of type string, TYPO3\CMS\Core\Resource\FileReference given

the problem is that in
vendor/typo3/cms-frontend/Classes/Typolink/LinkFactory.php:70 (https://github.com/TYPO3/typo3/blob/main/typo3/sysext/frontend/Classes/Typolink/LinkFactory.php#L67)
the parameter of the typolink conf array is converted to string (or directly trimmed in TYPO3 11).
But in
vendor/typo3/cms-frontend/Classes/ContentObject/ContentObjectRenderer.php:999 (https://github.com/TYPO3/typo3/blob/main/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php#L943)
the FileReference is assigned, so it is not a string.

                if (!$url) {
                    // If no imagemagick / gm is available
                    $url = $imageFile;
                }

Also in the further link processing, the parameter is assumed to be a string (-> resolveLinkDetails). So just skipping the trim for FileReference won't work.

tested with TYPO3 11 and 12, code in main seems to have the same issue (see links above).

Actions #1

Updated by Garvin Hicking 4 months ago

  • Category set to Image Generation / GIFBUILDER
Actions

Also available in: Atom PDF