Project

General

Profile

Actions

Bug #89148

closed

Media viewhelper empty additionalConfig causes php warning

Added by Jarvis H about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-09-11
Due date:
% Done:

100%

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

Description

Typo3 version 9.5.9

Error message:

PHP Warning: array_merge_recursive(): Argument #2 is not an array in /typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php line 119

How to reproduce.

Remove typoscript setting:

lib.contentElement.settings.media.additionalConfig >

or remove value from additionalConfig argument in fluid partial FluidStyledContent/Partials/Media/Rendering/Video.html

<f:media file="{file}" class="{class}" additionalAttributes="" alt="{file.alternative}" title="{file.title}" additionalConfig="" />

Cause:

In TYPO3\CMS\Fluid\ViewHelpers\MediaViewHelper the following takes place without checking if $additionalConfig is an array

$additionalConfig = array_merge_recursive($this->arguments, $additionalConfig);

Possible solution:

Add is_array check:

if (!is_array($additionalConfig)) {
    $additionalConfig = [];
}

$additionalConfig = array_merge_recursive($this->arguments, $additionalConfig);
Actions

Also available in: Atom PDF