Project

General

Profile

Actions

Bug #102573

closed

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

Added by Daniel Siepmann 8 months ago. Updated 18 days ago.

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

100%

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 about 2 months 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 #2

Updated by Gerrit Code Review about 1 month ago

Patch set 2 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 #3

Updated by Gerrit Code Review about 1 month ago

Patch set 3 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 #4

Updated by Gerrit Code Review about 1 month ago

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

Actions #5

Updated by Georg Ringer about 1 month ago

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

Updated by Benni Mack 18 days ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF