#102573TypeError: strcasecmp(): Argument #1 ($string1) must be of type string, int given ArrayUtility::sortArraysByKey()
Description
The TYPO3 API does not state that ArrayUtility::sortArraysByKey() should only work for strings. One can expect it to work with integers as well.
But the given code leads to an type error:
\TYPO3\CMS\Core\Utility\ArrayUtility::sortArraysByKey([
[
'key' => 10,
],
[
'key' => 11,
],
], 'key');
I’d either expect it to working, or a proper note in PHPDoc and type check upfront.
The issue occurs in TYPO3 v12, not in v11. Probably due to the added strict_types=1.
Reviews 2
History 26
-
Gerrit Code Review pushed patch set 1 for main to change 84631 status
NewUnder Review 06/11/24, 20:50 -
Gerrit Code Review pushed patch set 2 for main to change 84631 06/15/24, 19:40
-
Gerrit Code Review pushed patch set 3 for main to change 84631 06/15/24, 20:24
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 84651 06/18/24, 05:51
-
Georg Ringer commented and changed status
Under ReviewResolved done0 %100 % 06/18/24, 05:55 -
Benni Mack changed status
ResolvedClosed 07/09/24, 15:12
Applied in changeset commit:9eaa5a0c96d58bed00aacbf33e5d27c4d5e2e014.