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

From: Date: Mon, 25 Jun 2018 20:12:17 +0000
Subject: Bug #76528 [Opn->Fbk]: PCRE2 issues a warning about invalid ranges
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215970@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: danack@php.net Reported by: mail at jens-hausdorf dot de Summary: PCRE2 issues a warning about invalid ranges -Status: Open +Status: Feedback Type: Bug Package: PCRE related Operating System: Windows 10 Home PHP Version: 7.3.0alpha2 Block user comment: N Private report: N New Comment: 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); Previous Comments: ------------------------------------------------------------------------ [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 (#215970) next »