vhs icon indicating copy to clipboard operation
vhs copied to clipboard

PHP 8 warning exception due to missing array keys: Undefined array key "params"

Open tomashavner opened this issue 3 years ago • 1 comments
trafficstars

Hi,

In ext/vhs/Classes/ViewHelpers/Media/SourceViewHelper.php there is a missing key array in line 136. Adding a params key to the setup array fixes this (line 119 ff): $setup = [ 'width' => $this->arguments['width'], 'height' => $this->arguments['height'], 'minW' => $this->arguments['minW'], 'minH' => $this->arguments['minH'], 'maxW' => $this->arguments['maxW'], 'maxH' => $this->arguments['maxH'], 'treatIdAsReference' => $treatIdAsRerefence, 'params' => null ];

Kind regards

Tomas

tomashavner avatar Sep 12 '22 14:09 tomashavner

same here:

PHP Warning: Undefined array key "tt_content:576" in /typo3conf/ext/vhs/Classes/ViewHelpers/Content/AbstractContentViewHelper.php line 222

javagotchi avatar Sep 15 '22 12:09 javagotchi

Changing line 222 from if (0 < $GLOBALS['TSFE']->recordRegister['tt_content:' . $row['uid']]) { to if (0 < ($GLOBALS['TSFE']->recordRegister['tt_content:' . $row['uid']] ?? 0)) { seems to fix it for me

Skywalker-11 avatar Nov 23 '22 20:11 Skywalker-11

why not just if (array_key_exists('tt_content:' . $row['uid'], $GLOBALS['TSFE']->recordRegister)) { ?

j0nnybrav079 avatar Nov 24 '22 16:11 j0nnybrav079

why not just if (array_key_exists('tt_content:' . $row['uid'], $GLOBALS['TSFE']->recordRegister)) { ?

I don't know the details of the vhs implementation but assumed having 0 or negative values might have a special meaning which would not be covered with your if statement alone.

Skywalker-11 avatar Nov 24 '22 18:11 Skywalker-11

Fixed via https://github.com/FluidTYPO3/vhs/commit/99e05be074c03e10a6ef2f9c244f805d8d9d8b8f#diff-0204d72a43461de588cbf25b096822c3133ee7143540efd05241eaa9172460ff (originally reported issue).

Issue from comments is dupe of https://github.com/FluidTYPO3/vhs/issues/1787.

NamelessCoder avatar Nov 25 '22 15:11 NamelessCoder