Warning when building an empty workspace tree

Created on 23 June 2020, over 4 years ago
Updated 17 February 2023, almost 2 years ago

When creating a workspace in the live environment, I get a warning which causes the page to crash:

Warning: array_replace(): Expected parameter 1 to be an array, null given in core/modules/workspaces/src/Plugin/EntityReferenceSelection/WorkspaceSelection.php on line 72

As far as I can see, this line sometimes returns a NULL value:

$workspace_tree = $this->workspaceRepository->loadTree();

This causes the next line to throw the warning.

$entities = array_replace($workspace_tree, $storage->loadMultiple());

A simple check if the $workspace_tree variable is an array, and else setting it fixes the issue.

$workspace_tree = $this->workspaceRepository->loadTree();
$workspace_tree = is_array($workspace_tree) ? $workspace_tree : [];
πŸ› Bug report
Status

Fixed

Version

9.5

Component
WorkspacesΒ  β†’

Last updated 4 days ago

No maintainer
Created by

πŸ‡§πŸ‡ͺBelgium mheip

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024