|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76528 PCRE2 issues a warning about invalid ranges
Submitted: 2018-06-25 19:48 UTC Modified: 2018-06-26 01:48 UTC
From: mail at jens-hausdorf dot de Assigned:
Status: Duplicate Package: PCRE related
PHP Version: 7.3.0alpha2 OS: Windows 10 Home
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
13 + 2 = ?
Subscribe to this entry?

 [2018-06-25 19:48 UTC] mail at jens-hausdorf dot de
It's working fine in 7.2 however.

Test script:
preg_match('/^[\\w-\\.]+$/', 'admin.general.canViewPrivateUserOptions')

Expected result:
no php warning

Actual result:
PHP Warning:  preg_match(): Compilation failed: invalid range in character class at offset 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-25 20:12 UTC]
-Status: Open +Status: Feedback
 [2018-06-25 20:12 UTC]
Can you check - that looks like the error message is right, and the pattern probably isn't what you want.

As you have it in your script, it means "any character that is between any word character to a dot", which doesn't make sense.

If the pattern was instead "[\w\.]" that would mean any word character or a dot.....which is possibly what you meant?

Testing at:

preg_match('/^[\w\.]+$/', 'admin.general.canViewPrivateUserOptions', $matches);

preg_match('/^[\w-\.]+$/', 'admin.general.canViewPrivateUserOptions', $matches);

preg_match('/^[\\w-\\.]+$/', 'admin.general.canViewPrivateUserOptions', $matches);
 [2018-06-26 01:48 UTC]
-Status: Feedback +Status: Duplicate
 [2018-06-26 01:48 UTC]
See bug #76188
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 21:01:29 2024 UTC