|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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: Wed Jul 17 22:01:28 2024 UTC