Missing GTM ID causes PHP warning: passing null to parameter #2 of preg_match deprecated in TagContainer.php

Created on 27 May 2024, 7 months ago
Updated 8 August 2024, 4 months ago

Problem/Motivation

Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\google_tag\Entity\TagContainer::Drupal\google_tag\Entity\{closure}() (line 210 of modules/contrib/google_tag/src/Entity/TagContainer.php).

Steps to reproduce

PHP warning visible on any page as long as no GTM ID is saved.

Proposed resolution

Prepending is_string($id) && to preg_match. See patch.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium jummonk

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