75732[TASK] Prevent undefined array key warnings in ext:beuser
Commit message
Review
-
Code review CR +2 Done
- Oliver Hader +2
- Oliver Klee +1
- Stefan Bürk +1
- Christian Kuhn +1
-
Verified V +2 Done
- Oliver Hader +2
- Stefan Bürk +1
- Christian Kuhn +1
- core-ci +1 CI
Issues 2
Files 9
- typo3/sysext/beuser/Classes/Controller/BackendUserController.php4+3 −2
- typo3/sysext/beuser/Classes/Controller/PermissionController.php+5 −4
- typo3/sysext/beuser/Classes/Domain/Model/BackendUser.php+1 −1
- typo3/sysext/beuser/Classes/Service/UserInformationService.php6+20 −16
- typo3/sysext/beuser/Classes/ViewHelpers/Display/TableAccessViewHelper.php+7 −2
- typo3/sysext/beuser/Classes/ViewHelpers/ArrayElementViewHelper.php2+1 −0
- typo3/sysext/beuser/Classes/ViewHelpers/PermissionsViewHelper.php4+21 −13
- typo3/sysext/beuser/Classes/ViewHelpers/SpriteIconForRecordViewHelper.php2+3 −0
- typo3/sysext/beuser/Classes/ViewHelpers/SwitchUserViewHelper.php+2 −0
Review log 1417
-
Oliver Hader uploaded patch set 1 09/15/22, 09:35
-
core-ci voted on patch set 1 V +1 09/15/22, 09:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31103
-
Oliver Klee commented on patch set 1 09/15/22, 09:58
BackendUserGroupRepository.php:53Also, this looks a bit out of scope for this change and should go into a separate change.BackendUserGroupRepository.php:53Just to be safe, we should use a named parameter with Connection::PARAM_INT_ARRAY.UserInformationService.php:128We need to skip these two lines if $recordUid is null.UserInformationService.php:226We should skip this line if $itemField is an empty string.ArrayElementViewHelper.php:44To make it more clear to clear to the read at the first glance what is what, pleas let's put at least the array key "array" into quotes (or for consistency, all array keys in this array shape).PermissionsViewHelper.php:99@param value-of<self::MASKS> $maskSpriteIconForRecordViewHelper.php:56Same as above: Please let's have quotes at least around the array key "object". -
Oliver Hader commented on patch set 1 09/16/22, 06:52
BackendUserGroupRepository.php:53ReplyNo, that's the Extbase Query BuilderBackendUserGroupRepository.php:53ReplyFineUserInformationService.php:128ReplyIt reflects the current behavior, `null` is casted implicitly to `string` as array key. Using `if (isset($record['uid']))` would change that behavior - but I agree, it would make more sense.UserInformationService.php:226ReplyAgain, that would change the current behaviorPermissionsViewHelper.php:99ReplyHow would that be helpful, and why is `int` not enough here? -
Oliver Hader commented on patch set 1 09/16/22, 07:11
BackendUserGroupRepository.php:53Reply -
Oliver Hader uploaded patch set 2 09/16/22, 07:32
-
core-ci voted on patch set 2 V +1 09/16/22, 07:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31148
-
Oliver Hader commented on patch set 2 09/16/22, 07:45
BackendUserController.php:252ReplyDoneBackendUserGroupRepository.php:53ReplyDoneBackendUserGroupRepository.php:53Reply→ extracted to https://review.typo3.org/c/Packages/TYPO3.CMS/+/75736UserInformationService.php:128ReplyDoneUserInformationService.php:226ReplyDoneArrayElementViewHelper.php:44ReplyDonePermissionsViewHelper.php:99ReplySkipped thisSpriteIconForRecordViewHelper.php:56ReplyDone -
Christian Kuhn updated the commit message in patch set 3 09/16/22, 08:32
-
core-ci voted on patch set 3 V +1 09/16/22, 08:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31152
-
Oliver Klee commented on patch set 3 09/16/22, 09:52
BackendUserController.php:248I think have the positive case first and the fallback would make this a bit easier to understand (as this is the way most other ternary-operator usages in the core work).BackendUserGroupRepository.php:53ReplyAck, and thanks!PermissionsViewHelper.php:99ReplyThis helps static analysis as this narrows the allowed values of $mask from "any possible int, including negative values, zero and 12341234" to "only values from the corresponding array", which allows PHPStan to …: 1. know in the method that the values of $mask are within those values 2. complain if callers put in "any random int", which helps catch bad calls (code-wise) -
Christian Kuhn voted on patch set 3 V +1 CR +1 09/16/22, 10:27
-
Christian Kuhn commented on patch set 3 09/16/22, 10:29
BackendUserController.php:248Replythat's a minor detail. i'd be fine to keep it like it is for now. -
Stefan Bürk voted on patch set 3 V +1 CR +1 09/16/22, 11:37
-
Oliver Klee voted on patch set 3 CR +1 09/16/22, 13:14
-
Oliver Hader voted on patch set 3 V +2 CR +2 09/19/22, 15:21
-
Oliver Hader merged patch set 4 09/19/22, 15:22
BackendUserController.php:252