Issue Bug Closed

#94378PHP Warning: array_key_exists() expects parameter 2 to be array, null given in /var/www/public/typo3/sysext/core/Classes/Utility/ArrayUtility.php line 297

Netresearch DTT GmbH 06/18/21, 12:09 updated 06/19/21, 12:03

Description

Related to https://forge.typo3.org/issues/90241

Inside \TYPO3\CMS\Core\Utility\ArrayUtility::setValueByPath() no type check is executed when working with arrays.

This can lead to the PHP warning “array_key_exists() expects parameter 2 to be array”.

Example call causing the warning:

\TYPO3\CMS\Core\Utility\ArrayUtility::setValueByPath(
[
‘foo’ => [
‘bar’ => null,
],
],
‘foo/bar/baz’,
123
);

The expected behaviour would be to not throw a \TYPO3\CMS\Core\Error\Exception.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.