71532[BUGFIX] Undefined array keys related to workspaces
Commit message
Review
-
Code review CR +2 Done
- Benni Mack +2
- Jochen Roth +1
-
Verified V +2 Done
- Benni Mack +2
- Jochen Roth +1
- core-ci +1 CI
Issues 1
Files 2
Review log 1315
-
Francois Suter uploaded patch set 1 10/11/21, 13:17
-
Nikita Hovratov commented on patch set 1 CR -1 10/11/21, 13:28
-
Francois Suter commented on patch set 1 10/11/21, 13:31
WorkspaceRecord.php:227ReplyI can see your point, although I don't think it changes the end result. But I'll upload a new version. -
Christian Kuhn commented on patch set 1 CR -1 10/11/21, 13:33
The change in BackendUserAuthentication is ok. In case we need to discuss the other two places longer, we could also split the change to already bring in the BackendUserAuthentication change since that's also ext:core and not only ext:workspaces.AbstractRecord.php:90I don't understand this one. AbstractRecord is used for StageRecord and WorkspaceRecord. Both tables have uid's and instances of this class seem to be created via the static fetch() method above, which explicitely uses a uid WHERE. So I wonder how / why there can be no uid here? Maybe this could / should be fixed elsewhere and the getUid() is a misuse here? Maybe actively throw an exception here if getUid() on a non-record is called? -
Francois Suter commented on patch set 1 10/11/21, 13:38
Reply
OK, makes sense.AbstractRecord.php:90ReplyI agree that this should probably be fixed upstream, but I don't know where. What I observed is that when you're in the LIVE workspace "$this->record" is actually "null". -
core-ci voted on patch set 1 V +1 10/11/21, 13:39 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17918
-
Christian Kuhn commented on patch set 1 10/11/21, 13:49
AbstractRecord.php:90ReplyI see. Could be worth checking the reason, I'd say, though. Imho instances of these models should not be called / used when they can't be created properly, thus the exception instead. -
Francois Suter commented on patch set 1 10/11/21, 13:57
AbstractRecord.php:90ReplyHere's what happens: the ReviewController tries to get all the stages available for the user in the given workspace by calling: "\TYPO3\CMS\Workspaces\Service\StagesService::getStagesForWSUser()". This triggers the following call: $stageRecords = $this->getWorkspaceRecord()->getStages(); \TYPO3\CMS\Workspaces\Service\StagesService::getWorkspaceRecord() does just this: return WorkspaceRecord::get($this->getWorkspaceId()); When the workspace id is 0, an empty array is returned. So we have indeed a situation where AbstractRecord is created with "$this->record" being an empty array, thus no uid. So the correct fix is to do like "\TYPO3\CMS\Workspaces\Service\StagesService::getStagesForWS()": if ($this->getWorkspaceId() === 0) { $stages = []; } I'll do that in a separate patch. -
Francois Suter uploaded patch set 2 10/11/21, 13:59
-
Francois Suter commented on patch set 2 10/11/21, 14:00
Reply
I haven't separated it, as the new patch is simpler and I separated the controversial part about AbstractRecord. -
Francois Suter commented on patch set 2 10/11/21, 14:07
Reply
Here's the related patch: https://review.typo3.org/c/Packages/TYPO3.CMS/+/71533 -
core-ci voted on patch set 2 V +1 10/11/21, 14:14 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17920
-
Jochen Roth voted on patch set 2 V +1 CR +1 10/11/21, 15:10
-
Benni Mack voted on patch set 2 V +2 CR +2 10/11/21, 18:15
-
Benni Mack merged patch set 3 10/11/21, 18:15
WorkspaceRecord.php:227