Bug #102820
opendirectImageLink without imagemagick or gm leads to Error: Object of class TYPO3\CMS\Core\Resource\FileReference could not be converted to string
0%
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).
Updated by Garvin Hicking 4 months ago
- Category set to Image Generation / GIFBUILDER