hook_rabbit_hole_response_alter generates a TypeError for nodes with default settings

Created on 10 February 2025, about 2 months ago

Problem/Motivation

hook_rabbit_hole_response_alter generates a TypeError for nodes with default settings:

TypeError: rabbit_hole_rabbit_hole_response_alter(): Argument #1 ($response) must be of type Response, null given, called in /[...]/core/lib/Drupal/Core/Extension/ModuleHandler.php on line 459 in rabbit_hole_rabbit_hole_response_alter() (line 85 of modules/contrib/rabbit_hole/rabbit_hole.module).

Steps to reproduce

  1. Enable Rabbit hole for nodes
  2. Configure a node type to 'Display page'
  3. Implement hook_rabbit_hole_response_alter
  4. Visit a node of the node type

Proposed resolution

Allow $response in hook_rabbit_hole_response_alter() to be NULL.

Remaining tasks

  1. Write a merge request
  2. Review
  3. Commit

User interface changes

None

API changes

hook_rabbit_hole_response_alter() now allows $response to be NULL.

Data model changes

None

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇳🇱Netherlands idebr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024