ContextAll condition brakes on unknown context

Created on 31 May 2022, over 2 years ago
Updated 9 August 2024, 3 months ago

Problem/Motivation

I placed a block which referred to a context I already deleted. This value remained at Context (all). This broke the application and resulted in the following error: Error: Call to a member function getConditions() on null in Drupal\context\Plugin\Condition\ContextAll->getCacheContexts() (line 78 of modules/contrib/context/src/Plugin/Condition/ContextAll.php).

Steps to reproduce

  1. Fresh install Drupal with Context module enabled
  2. In block layout edit a block which is currently displayed
  3. At Context (all) fill out a name of a non-existing context
  4. Save the configuration and notice your site is broken
πŸ› Bug report
Status

Fixed

Version

4.1

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands bizar1984

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.

  • πŸ‡ΊπŸ‡ΈUnited States aitala

    I got hit with this error all of a sudden on a site that's been working for quite a while.

    After I applied the patch, the site came back online, and there was an all site context that didn't do anything but that should not have changed recently...

    ??

    Thanks,
    Eric

  • πŸ‡©πŸ‡ͺGermany demonde

    I still get this error message using a context block condition using a wildcard like subsite_*.

  • πŸ‡§πŸ‡ͺBelgium RandalV

    Can confirm I also still get this, I'm using the google_tag module and in Context (any) the value was: *

    Simply removing * and leaving it empty works for me, but that won't work for anyone using a value like: generic_name_*

  • πŸ‡¬πŸ‡§United Kingdom surfgatinho

    Still broken.

    Error occurs when using wildcard * as described above.

Production build 0.71.5 2024