PHP warning: Deprecated function: preg_quote()

Created on 8 May 2024, about 2 months ago

Problem/Motivation

Drupal: 10.0.11
PHP: 8.1.27
DB: 5.7.42-46-log

I am getting this error when I put my site on maintenance mode:

Deprecated function: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in Drupal\Core\Path\PathMatcher->matchPath() (line 82 of /Drupal/Core/Path/PathMatcher.php)

Steps to reproduce

Proposed resolution

Change the code on the file MaintenanceModeExempt.php to validate that the field is not empty since this field is not required:

    // Check if the URL should be exempted.
    $exempt_urls = \Drupal::config('maintenance_exempt.settings')->get('exempt_urls');

    if (!empty($exempt_urls)) {
      // Check the actual URL.
      $current_url = $this->request->getPathInfo();
      if ($this->pathMatcher->matchPath($current_url, $exempt_urls)) {
        return TRUE;
      }
    }
🐛 Bug report
Status

RTBC

Version

1.3

Component

Code

Created by

🇵🇹Portugal guilherme-lima-almeida Lisbon

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