Review main Merged

69508[BUGFIX] Fix Undefined array key error in PHP8 for EXT:workspaces

Jochen Roth CR +2 V +2 Normal +138 −31 updated 06/21/21, 09:49

Commit message

Will fix creation/edit content as well as publishing
workflow for workspaces and add a basic ac test
for page change, switch workspace and publish

Also EXT:workspaces is now enabled in test environment

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

Review log 1928

Show 23 earlier messages
  1. Jochen Roth uploaded patch set 1 06/17/21, 10:51

  2. 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

  3. Jochen Roth uploaded patch set 2 06/17/21, 12:41

  1. 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

  2. Jochen Roth uploaded patch set 3 06/17/21, 16:20

  3. 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

  4. Jochen Roth uploaded patch set 4 06/18/21, 08:13

  5. 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

  6. Jochen Roth uploaded patch set 5 06/18/21, 08:44

  7. 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

  8. Oli Bartsch commented on patch set 5 06/18/21, 10:26

    NewRecordController.php:248

    This may lead to false results since there are surely pages with pid=0 available. I suggest something like: $this->pidInfo = isset($this->pageinfo['pid']) ? BackendUtility::getRecord('pages', $this->pageinfo['pid']) ?? [] : []; Also note, getRecord() returns NULL, not FALSE. Since $this->pidInfo is defined as array, this should be ?? [] instead of ?: []. Otherwise $this->pidInfo could be set to NULL here.

    NewRecordController.php:289

    Not 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:1978

    When already changing this line, lets also "secure" this array access.

    CachingFrameworkGarbageCollectionAdditionalFieldProvider.php:139

    Let's make this strict. Therefore always cast $backend to string in the line above: $backend = (string)($cacheConfiguration['backend'] ?? '');

    GridDataService.php:530

    I 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)
  9. Oli Bartsch commented on patch set 5 06/18/21, 10:36

    NewRecordController.php:248 Reply

    > 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.
  10. Jochen Roth uploaded patch set 6 06/18/21, 11:45

  11. 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

  12. Jochen Roth uploaded patch set 7 06/18/21, 13:35

  13. 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

  14. 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:119

    This 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?
  15. Jochen Roth commented on patch set 7 06/21/21, 06:51

    NewRecordController.php:248 Reply

    Done

    NewRecordController.php:289 Reply Unresolved

    I think this is correct, happens only when you create a page on PID 0

    NewRecordController.php:366 Reply

    Done

    BackendUtility.php:1978 Reply

    Done

    CachingFrameworkGarbageCollectionAdditionalFieldProvider.php:139 Reply

    Done

    GridDataService.php:530 Reply

    Done

    HistoryService.php:119 Reply

    PHPStand 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.
  16. Oliver Klee commented on patch set 7 06/21/21, 08:21

    HistoryService.php:119 Reply

    You 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 */
  17. Oli Bartsch commented on patch set 7 06/21/21, 08:33

    CachingFrameworkGarbageCollectionAdditionalFieldProvider.php:139 Reply

    in_array is still not using third parameter $strict.

    GridDataService.php:530

    You removed the null coalescing again. So the PHP warning could still be triggered.
  18. Jochen Roth uploaded patch set 8 06/21/21, 09:02

  19. 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

  20. Jochen Roth commented on patch set 8 06/21/21, 09:21

    CachingFrameworkGarbageCollectionAdditionalFieldProvider.php:139 Reply

    Sorry missed that. Done now

    GridDataService.php:530 Reply

    Done

    HistoryService.php:119 Reply

    Done, thanks for that hint
  21. Oli Bartsch uploaded patch set 9 06/21/21, 09:28

  22. Oli Bartsch voted on patch set 9 V +1 CR +1 06/21/21, 09:30

  23. 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

  24. Benni Mack voted on patch set 9 V +2 CR +2 06/21/21, 09:49

  25. Benni Mack merged patch set 10 06/21/21, 09:49