|  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mail at jens-hausdorf dot de
New email:
PHP Version: OS:


 [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: Sun Jun 23 08:01:28 2024 UTC