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 7 months ago. Updated 3 days ago.

Status:
Under Review
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.

Actions #1

Updated by Gerrit Code Review 3 days ago

  • Status changed from New to Under Review

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

Actions

Also available in: Atom PDF