#102820directImageLink without imagemagick or gm leads to Error: Object of class TYPO3\CMS\Core\Resource\FileReference could not be converted to string
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).
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 3
-
Garvin Hicking changed category <span data-processor="relativetime" data-value="2024-07-31T09:55:17+00:00" > 07/31/24, 09:55 </span>
-
Georg Ringer commented and changed status
NewClosed <span data-processor="relativetime" data-value="2026-09-28T20:39:46+00:00" > 09/28/26, 20:39 </span> -
Georg Ringer changed Duplicates #93345 <span data-processor="relativetime" data-value="2026-09-28T20:39:53+00:00" > 09/28/26, 20:39 </span>
fixed with #93345, if this is still valid for you in v14, please open a new issue and provide information to reproduce it.