Bug #76528 [Fbk->Dup]: PCRE2 issues a warning about invalid ranges

From: Date: Tue, 26 Jun 2018 01:49:01 +0000
Subject: Bug #76528 [Fbk->Dup]: PCRE2 issues a warning about invalid ranges
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215972@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76528&edit=1 ID: 76528 Updated by: requinix@php.net Reported by: mail at jens-hausdorf dot de Summary: PCRE2 issues a warning about invalid ranges -Status: Feedback +Status: Duplicate Type: Bug Package: PCRE related Operating System: Windows 10 Home PHP Version: 7.3.0alpha2 Block user comment: N Private report: N New Comment: See bug #76188 Previous Comments: ------------------------------------------------------------------------ [2018-06-25 20:12:12] danack@php.net 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: https://3v4l.org/66NDo preg_match('/^[\w\.]+$/', 'admin.general.canViewPrivateUserOptions', $matches); var_dump($matches); preg_match('/^[\w-\.]+$/', 'admin.general.canViewPrivateUserOptions', $matches); var_dump($matches); preg_match('/^[\\w-\\.]+$/', 'admin.general.canViewPrivateUserOptions', $matches); var_dump($matches); ------------------------------------------------------------------------ [2018-06-25 19:48:24] mail at jens-hausdorf dot de Description: ------------ It's working fine in 7.2 however. Test script: --------------- <?php 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76528&edit=1

« previous php.bugs (#215972) next »