Problem/Motivation
If something asks for the active workspace before a request is pushed onto the RequestStack, getActiveWorkspace() passes NULL to WorkspaceNegotiatorInterface::applies(Request $request) and PHP throws a TypeError.
We hit this on a site with Workspaces enabled and Shield installed. After a cache clear, Shield's middleware looks up an alias early. The alias whitelist is empty, so WorkspacesAliasRepository::getBaseQuery() calls hasActiveWorkspace(), which crashes:
TypeError: QueryParameterWorkspaceNegotiator::applies(): Argument #1 ($request) must be of type Request, null given, called in WorkspaceManager.php
Steps to reproduce
1. Enable Workspaces and Shield.
2. Clear caches.
3. Load any page.
Proposed resolution
Return FALSE from getActiveWorkspace() when getCurrentRequest() is NULL.
Issue fork drupal-3638082
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
edwardsay commented