Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation / better optimization for backdrop_match_path()? #6840

Open
laryn opened this issue Jan 28, 2025 · 1 comment
Open

Deprecation / better optimization for backdrop_match_path()? #6840

laryn opened this issue Jan 28, 2025 · 1 comment

Comments

@laryn
Copy link
Contributor

laryn commented Jan 28, 2025

Description of the bug

I'm seeing this warning on a site that I'm working on locally:

Deprecated function: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in backdrop_match_path() (line 311 of /var/www/vhosts/sotp/live/core/includes/path.inc).

Steps To Reproduce

I'm still looking for ways to reproduce with a minimal installation.

Actual behavior

Deprecated warning is generated due to a deprecation.

Expected behavior

Deprecation is not triggered and no warning is generated.

Additional information

This may be due to the Domain module as I haven't seen it elsewhere and the site I'm looking at locally is a D7 upgrade that is using Domain. That said, in looking at backdrop_match_path() it seems we may be able to just skip processing if no patterns exist (ie. if $patterns is empty) and avoid this whole deprecation, which occurs further down when $patterns is submitted to preg_quote.

Backdrop 1.30.0
PHP 8.1.x

@herbdool
Copy link

herbdool commented Feb 3, 2025

You could have an early return of false if $patterns is null, or not a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants