#98321Address "undefined array key" issues for PHP 8
Description
I’m pretty sure there are still a bunch of “undefined array key” warnings hidden in the TYPO3 core when used in combination with PHP 8.
To identify and address those issues, I created a PsalmPHP plugin tweaking some static code analysis topics (e.g. static/self references, or ignoring $GLOBALS) for creating a list with potential code locations that could be enhanced. This list is quite long and some aspects might feel okayish… Anyway, I’m just posting the results as TXT and SARIF file.
Processing
# process with max. 1 thread
bin/psalm --memory-limit=8G --threads=1 --no-cache \
--report=results.sarif --output-format=github
# Visual Studio Code SARIF needs special JSON and absolute paths
(@sed@ on macOS neeeds `-i ''`, on Linux just `-i`)
sed -i '' \
-e 's,\\/,/,g' \
-e's,{"uri":"typo3/,{"uri":"'"$(pwd)"'/typo3/,g' results.sarif
Tools
Subtasks
The subtasks of this issue are basically all system extensions, that have been approached systematically. Arbitrary one-liners can be referenced, but not added as subtasks.
Reviews 6
- main 75682[EXPERIMENTAL] PsalmPHP: Address "undefined array key" issues for PHP 8
- 11.5 75777[EXPERIMENTAL] PsalmPHP: Address "undefined array key" issues for PHP 8
- 11.5 75986[TASK] Prevent undefined array key warnings in ext:filelist
- main 75843[TASK] Prevent undefined array key warnings in ext:filelist
- 11.5 75775[TASK] Prevent undefined array key warnings in ext:beuser
- main 75732[TASK] Prevent undefined array key warnings in ext:beuser
Subtasks 9
- Task #98324Address "undefined array key" issues in ext:adminpanel
- Task #98325Address "undefined array key" issues in ext:belog
- Task #98329Prevent undefined array key warnings in ext:dashboard
- Task #98347Prevent undefined array key warnings in ext:beuser
- Task #98407Prevent undefined array key warnings in ext:extbase
- Task #98408Prevent undefined array key warnings in ext:extensionmanager
- Task #98409Prevent undefined array key warnings in ext:form
- Task #98410Prevent undefined array key warnings in ext:felogin
- Task #98411Prevent undefined array key warnings in ext:filelist
Related issues 9
- Bug #97619Undefined array key "_CURRENT_VERSION" in CleanFlexFormsCommand
- Bug #98274Undefined array key "skipIfValueIsEmpty" in SaveToDatabaseFinisher (PHP 8)
- Bug #98337 Undefined array key "_CURRENT_VERSION" in WorkspaceVersionRecordsCommand
- Bug #98358Undefined array key "exec" in ExtensionManagementUtility
- Bug #98359PHP Warning: Undefined array key 0 in SchedulerCommand.php
- Bug #98361PHP Warning: Undefined array key "_CURRENT_VERSION" in WorkspaceVersionRecordsCommand
- Bug #98387PHP Warning: Undefined array key "XYZ" in File line 184
- Bug #98406PHP Warning: Undefined array key X in AbstractItemProvider
- Bug #98412PHP Warning: Undefined array key "xyz" in ProcessedFile