preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated

Created on 11 May 2022, about 2 years ago
Updated 21 February 2023, over 1 year ago

Problem/Motivation

When using PHP 8.1 the following error is displayed:

Deprecated function: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in Drupal\Core\Path\PathMatcher->matchPath() (line 82 of core/lib/Drupal/Core/Path/PathMatcher.php).
Drupal\Core\Path\PathMatcher->matchPath('/admin/config', NULL) (Line: 1433)
mailchimp_page_bottom(Array) (Line: 355)
Drupal\Core\Render\MainContent\HtmlRenderer->buildPageTopAndBottom(Array) (Line: 150)

Steps to reproduce

  1. Using Drupal 9.3.12
  2. With PHP 8.1
  3. Install mailchimp module
  4. Configure mailchimp module
  5. Enable 'Enable connected site' - but without connecting this site to Mailchimp first!
  6. When viewing any page the warning will be displayed.

Proposed resolution

Check if $connected_site_paths is not null before testing the paths.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

General

Created by

πŸ‡¬πŸ‡§United Kingdom 3li U.K. πŸ‡¬πŸ‡§

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024