Warning when building an empty workspace tree

Created on 23 June 2020, about 4 years ago
Updated 17 February 2023, over 1 year 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 16 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.69.0 2024