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

Missing delimiter for preg_match pattern in UrlHelper::inArrayMatchesRegex #22248

Closed
jberiksen opened this issue May 24, 2024 · 5 comments · Fixed by #22256
Closed

Missing delimiter for preg_match pattern in UrlHelper::inArrayMatchesRegex #22248

jberiksen opened this issue May 24, 2024 · 5 comments · Fixed by #22256
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@jberiksen
Copy link

I got this errors in my log
preg_match(): Delimiter must not be alphanumeric or backslash in /core/UrlHelper.php:41
preg_match(): Delimiter must not be alphanumeric or backslash in /core/UrlHelper.php:46

Matomo version: 5.0.3
PHP version: 8.1.28

As I see the solution could be this lines insted
Line 41: if(@preg_match("/$val/", null) === false) {
Line 46: if( preg_match("/$val/", $test) === 1 ) {

@michalkleiner
Copy link
Contributor

Do you know what value is passed in that triggers the error?

@michalkleiner
Copy link
Contributor

Maybe we need to add some preg_quote but that's just a quess.

@sgiehl
Copy link
Member

sgiehl commented May 27, 2024

The problem is in our code. We are using preg_match($pattern, null) to check if a regex is valid. This might throw a notice on newer php versions. I'll prepare a PR to fix that.

@sgiehl sgiehl self-assigned this May 27, 2024
@sgiehl sgiehl added the Bug For errors / faults / flaws / inconsistencies etc. label May 27, 2024
@sgiehl sgiehl added this to the 5.1.0 milestone May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants