(1/1) TypeError strpos(): Argument #1 ($haystack) must be of type string, TYPO3\CMS\Core\Resource\FileReference given
subnoodle opened this issue · comments
Bug Report
Prerequisites
- [NO ] Can you reproduce the problem on TYPO3 v11.5 LTS
- [NO ] Can you reproduce the problem on TYPO3 v12.4 LTS
- [NO] Did you perform a cursory search
to see if your bug or enhancement is already reported?
Description
On some news-items the bootstrap-package throws an error when processing a svg-image as file-reference.
Other news-entries work.
The exception occurs in EXT:/bootstrap_package/Classes/ViewHelpers/Data/ImageInfoViewHelper.php::67 (version 14.0.7)
Steps to Reproduce
Not really reproduceable.
But: the viewhelper get a file-reference (object) instead of the file-name (string)
Expected behavior
no exception when the viewhelper processes a simple strpos-cmd.
Actual behavior
excpetion, see screenshot
Screenshots
Fix
change line 67:
from:
if (strpos($src, $mediaName) !== false) {
to:
if (is_string($src) && strpos($src, $mediaName) !== false) {
to make strpos typesafe.
Versions
You can get this information from executing composer show
at the command line
if your TYPO3 installation is composer based, otherwise the version number will
be shown in the extension manager.
Typo3 v11.5.32