Project

General

Profile

Actions

Bug #102573

open

TypeError: strcasecmp(): Argument #1 ($string1) must be of type string, int given ArrayUtility::sortArraysByKey()

Added by Daniel Siepmann 5 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2023-11-30
Due date:
% Done:

0%

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

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.

No data to display

Actions

Also available in: Atom PDF