Problem/Motivation

Deprecated theme suggestions can be added through the `__DEPRECATED`-key when adding suggestions.
This causes a fatal error in conjunction with the Preprocess-module, in the `PreprocessManager::preprocess` function we loop over the $suggestions and check if each theme_registry has the given suggestion, but the `__DEPRECATED` key is also available in the `$suggestions`-array, and the `__DEPRECATED` key is an array that contains one or more deprecated theme suggestions.
The cause of this issue, for us, was: https://www.drupal.org/node/3541462

Steps to reproduce

- Install preprocess on a Drupal 11.3 site
- See the error appear whenever a node inside a view gets preprocessed

Proposed resolution

Unset the `__DEPRECATED` key like the ThemeManager does during rendering (\Drupal\Core\Theme\ThemeManager::render() on line 224 in Drupal 11.3.10) like so:

    if (isset($suggestions['__DEPRECATED'])) {
      unset($suggestions['__DEPRECATED']);
    }

Issue fork preprocess-3592527

Command icon 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

randalv created an issue. See original summary.

randalv’s picture

Status: Active » Needs review
randalv’s picture

Issue summary: View changes

sjerdo made their first commit to this issue’s fork.

sjerdo’s picture

Status: Needs review » Reviewed & tested by the community

  • sjerdo committed 4596883c on 2.x authored by randalv
    fix: #3592527 Deprecated theme suggestions cause fatal error.
    
sjerdo’s picture

Thanks! Merged and tagged new version 2.2.3

sjerdo’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.