Bug #102573
closedTypeError: strcasecmp(): Argument #1 ($string1) must be of type string, int given ArrayUtility::sortArraysByKey()
100%
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
.
Updated by Gerrit Code Review 5 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
Updated by Gerrit Code Review 5 months 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
Updated by Gerrit Code Review 5 months 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
Updated by Gerrit Code Review 5 months 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
Updated by Georg Ringer 5 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 9eaa5a0c96d58bed00aacbf33e5d27c4d5e2e014.