Deprecated function: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\Core\Routing\RouteCompiler::getPatternOutline() (line 77 of core/lib/Drupal/Core/Routing/RouteCompiler.php)

Created on 12 December 2022, about 2 years ago
Updated 14 February 2023, almost 2 years ago

Problem/Motivation

Line 79 of RouteCompiler has this line:
return preg_replace('#\{\w+\}#', '%', $path);

This triggers a deprecation warning when running on PHP 8.1:

Deprecated function: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\Core\Routing\RouteCompiler::getPatternOutline() (line 77 of core/lib/Drupal/Core/Routing/RouteCompiler.php).

Steps to reproduce

Using PHP 8.1

πŸ› Bug report
Status

Needs work

Version

9.5

Component
RoutingΒ  β†’

Last updated 3 days ago

Created by

πŸ‡²πŸ‡¦Morocco elfakhar

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request β†’ as a guide.

    The issue summary could use steps for how you triggered this. While it may be good to fix it here we want to know what triggered it in the first place.

    As a bug it will need a test case too

Production build 0.71.5 2024