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

Created on 27 May 2024, about 1 month 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

Needs review

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium jummonk

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

Comments & Activities

Production build 0.69.0 2024