Problem/Motivation

On Drupal 11.3 and later, the **append_file_info** module triggers the following PHP warning:

Warning: Undefined array key "preprocess functions" in Drupal\append_file_info\Hook\ThemeHooks->themeRegistryAlter() (line 22 of modules/contrib/append_file_info/src/Hook/ThemeHooks.php).

This is caused by changes to the theme registry introduced in Drupal 11.3, where the `preprocess functions` array key is no longer guaranteed to exist for every theme hook.

Related Drupal core change: https://www.drupal.org/node/3504125

Steps to reproduce

1. Install Drupal 11.3 or later.
2. Install and enable the **append_file_info** module.
3. Rebuild caches.
4. Visit a page that triggers the module's `hook_theme_registry_alter()` implementation.
5. Observe the PHP warning in the logs or on-screen (if error display is enabled).

Proposed resolution

Update `ThemeHooks::themeRegistryAlter()` to account for the Drupal 11.3 theme registry changes by checking whether the `preprocess functions` key exists before attempting to access or modify it.

The implementation should be compatible with both older Drupal 11 releases and Drupal 11.3+.

Remaining tasks

* Update the implementation to safely handle missing `preprocess functions`.
* Verify compatibility with supported Drupal core versions.
* Add or update automated tests if applicable.
* Review and commit.

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

p-neyens created an issue. See original summary.

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

dkmishra’s picture

Status: Active » Needs review

  • p-neyens committed d35ec6db on 2.x authored by dkmishra
    Issue #3614232: Theme registry alter preprocess functions warning fix
    
p-neyens’s picture

@dkmishra We have amended the proposal to ensure that the theme implementation in D11+ is retained

p-neyens’s picture

Status: Needs review » 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.