benjaminkott / bootstrap_package

Bootstrap Package delivers a full configured theme for TYPO3, based on the Bootstrap CSS Framework.
https://www.bootstrap-package.com/
MIT License
338 stars 205 forks source link

(1/1) TypeError strpos(): Argument #1 ($haystack) must be of type string, TYPO3\CMS\Core\Resource\FileReference given #1439

Open subnoodle opened 1 year ago

subnoodle commented 1 year ago

Bug Report

Prerequisites

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

Screenshot 2023-10-26 at 17-09-36 TYPO3 Exception

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