Bug #90241

ArrayUtility "array_key_exists() expects parameter 2 to be array"

Added by Daniel Siepmann over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Category:
-
Start date:
2020-01-29
Due date:
% Done:

100%

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

Description

Inside \TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath() no type check is executed when working with array.
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::getValueByPath(
    [                  
        'foo' => [     
            'baz' => 42
        ],             
    ],                 
    'foo/baz/baz'
);

as during 2nd baz, the "array" is an integer.

The expected behaviour would be throw new MissingArrayPathException('Segment ' . $segment . ' of path ' . implode($delimiter, $path) . ' does not exist in array', 1341397869);, just like when the segment does not exist. As it does not exist.


Related issues

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

Actions
#1

Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63066

#2

Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63066

#3

Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62983

#4

Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62984

#5

Updated by Daniel Siepmann over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#6

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
#7

Updated by Netresearch GmbH & Co KG 6 days ago

  • Related to Bug #94378: PHP 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 added

Also available in: Atom PDF