500 error in Drupal 11.2

Created on 30 June 2025, 7 days ago

Problem/Motivation

After upgrading a project to Drupal 11.2, clicking the "View more" button on our views resulted in the js console reporting a server side 500 error.

Argument #1 ($elements) must be of type array, null given

I tracked it down to src/EventSubscriber/ShowMoreEventSubscriber.php. The change I made was to use the null coalescing operator in two places. One example for illustrative purposes is shown below. (See attached patch for actual changes.)

// This is the original line.
$footer_render = $footer->render();

// This is the fix I added.
$footer_render = $footer->render() ?? [];
🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇪🇪Estonia mmatsoo

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

Comments & Activities

Production build 0.71.5 2024