69508[BUGFIX] Fix Undefined array key error in PHP8 for EXT:workspaces
Commit message
Review
-
Code review CR +2 Done
- Benni Mack +2
- Oli Bartsch +1
-
Verified V +2 Done
- Benni Mack +2
- Oli Bartsch +1
- core-ci +1 CI
Issues 1
Files 15
- typo3/sysext/backend/Classes/Controller/EditDocumentController.php+2 −2
- typo3/sysext/backend/Classes/Controller/NewRecordController.php7+5 −5
- typo3/sysext/backend/Classes/Utility/BackendUtility.php2+1 −1
- typo3/sysext/core/Classes/DataHandling/DataHandler.php+2 −2
- typo3/sysext/core/Tests/Acceptance/Backend/Workspace/WorkspaceModuleCest.phpnew+98 −0
- typo3/sysext/core/Tests/Acceptance/Fixtures/workspaces.xmlnew+9 −0
- typo3/sysext/core/Tests/Acceptance/Support/Extension/BackendCoreEnvironment.php+3 −1
- typo3/sysext/scheduler/Classes/Task/CachingFrameworkGarbageCollectionAdditionalFieldProvider.php4+2 −2
- typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php+4 −4
- typo3/sysext/workspaces/Classes/Controller/Remote/MassActionHandler.php+1 −1
- typo3/sysext/workspaces/Classes/Controller/AjaxController.php+1 −1
- typo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php+1 −1
- typo3/sysext/workspaces/Classes/Service/GridDataService.php4+5 −5
- typo3/sysext/workspaces/Classes/Service/HistoryService.php4+4 −2
- phpstan.neon+0 −4
Review log 1928
Show 23 earlier messages
-
Jochen Roth uploaded patch set 1 06/17/21, 10:51
-
core-ci voted on patch set 1 V -1 06/17/21, 11:02 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12530
-
Jochen Roth uploaded patch set 2 06/17/21, 12:41
-
core-ci voted on patch set 2 V +1 06/17/21, 12:49 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12538
-
Jochen Roth uploaded patch set 3 06/17/21, 16:20
-
core-ci voted on patch set 3 V -1 06/17/21, 16:29 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12554
-
Jochen Roth uploaded patch set 4 06/18/21, 08:13
-
core-ci voted on patch set 4 V -1 06/18/21, 08:25 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12571
-
Jochen Roth uploaded patch set 5 06/18/21, 08:44
-
core-ci voted on patch set 5 V +1 06/18/21, 08:55 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12573
-
Oli Bartsch commented on patch set 5 06/18/21, 10:26
NewRecordController.php:289Not sure if defaulting this to 0 could lead to side effects since this should return "global" TSconfig.NewRecordController.php:366$this->pageinfo is initialized as array. Therefore, the is_array check seems superfluous. Suggest to just check for the uid with: if($this->pageinfo['uid'] ?? false)BackendUtility.php:1978When already changing this line, lets also "secure" this array access.CachingFrameworkGarbageCollectionAdditionalFieldProvider.php:139Let's make this strict. Therefore always cast $backend to string in the line above: $backend = (string)($cacheConfiguration['backend'] ?? '');GridDataService.php:530I think !empty() is change in bahaviour here. Would just "secure" the array access in the "is_array" check: is_array($backendUser->uc['moduleData']['Workspaces'][$backendUser->workspace]['columns'] ?? false) -
Oli Bartsch commented on patch set 5 06/18/21, 10:36
NewRecordController.php:248Reply> This may lead to false results since there are surely pages with pid=0 available. Sorry, this makes no sense. second parameter is UID. When using 0 as UID, the result of getRecord will always be NULL. Therefore no need for the isset() check. Just change the shorthanded-if to a null coalescing. -
Jochen Roth uploaded patch set 6 06/18/21, 11:45
-
core-ci voted on patch set 6 V -1 06/18/21, 11:57 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12581
-
Jochen Roth uploaded patch set 7 06/18/21, 13:35
-
core-ci voted on patch set 7 V +1 06/18/21, 13:48 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12588
-
crell commented on patch set 7 06/18/21, 21:46
Everything looks good PHP 8-wise. Thanks. One question on a string cast I don't quite grok.HistoryService.php:119This pair seem a bit odd. $field will always be defined as it's inside a foreach loop, but it's coming from the newRecord keys. If one of those is non-string, that seems like it's going to be a much bigger problem and it *should* blow up here, shouldn't it? -
Jochen Roth commented on patch set 7 06/21/21, 06:51
NewRecordController.php:248ReplyDoneNewRecordController.php:289Reply UnresolvedI think this is correct, happens only when you create a page on PID 0NewRecordController.php:366ReplyDoneBackendUtility.php:1978ReplyDoneCachingFrameworkGarbageCollectionAdditionalFieldProvider.php:139ReplyDoneGridDataService.php:530ReplyDoneHistoryService.php:119ReplyPHPStand complained about this, thats why i changed it: ``` Line workspaces/Classes/Service/HistoryService.php 118 Parameter #2 $col of static method TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue() expects string, int|string given. 119 Parameter #2 $col of static method TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue() expects string, int|string given. ``` Not sure if it should blow up here. -
Oliver Klee commented on patch set 7 06/21/21, 08:21
HistoryService.php:119ReplyYou can also annotate the variable like this to help PHPStan know that it's a string: /** @var string $field */ Or even better further above: /** @var array<int, string> $fields */ -
Oli Bartsch commented on patch set 7 06/21/21, 08:33
CachingFrameworkGarbageCollectionAdditionalFieldProvider.php:139Replyin_array is still not using third parameter $strict.GridDataService.php:530You removed the null coalescing again. So the PHP warning could still be triggered. -
Jochen Roth uploaded patch set 8 06/21/21, 09:02
-
core-ci voted on patch set 8 V +1 06/21/21, 09:13 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12615
-
Jochen Roth commented on patch set 8 06/21/21, 09:21
CachingFrameworkGarbageCollectionAdditionalFieldProvider.php:139ReplySorry missed that. Done nowGridDataService.php:530ReplyDoneHistoryService.php:119ReplyDone, thanks for that hint -
Oli Bartsch uploaded patch set 9 06/21/21, 09:28
-
Oli Bartsch voted on patch set 9 V +1 CR +1 06/21/21, 09:30
-
core-ci voted on patch set 9 V +1 06/21/21, 09:45 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12620
-
Benni Mack voted on patch set 9 V +2 CR +2 06/21/21, 09:49
-
Benni Mack merged patch set 10 06/21/21, 09:49
NewRecordController.php:248