TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array()

Created on 17 April 2024, 2 months ago
Updated 18 April 2024, 2 months ago

Problem/Motivation

After installing and enabling the module on a Drupal 10.1 project,
editing or creating content gives:

The website encountered an unexpected error. Please try again later.

TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 416 of modules/contrib/content_notify/src/ContentNotifyManager.php).

Steps to reproduce

Install and enabled Content notification module

Click to edit existing content or "Add Content" and select content to be created

Note the above error.

Proposed resolution

Amend line 416 in ContentNotifyManager.php

From:
return in_array($node_type, $this->config->get('notify_' . $action . '_bundles'));

To:
return in_array($node_type, $this->config->get('notify_' . $action . '_bundles') ?: []);

๐Ÿ› Bug report
Status

RTBC

Version

3.0

Component

Code

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom Michelle-Buckby

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024