Bug #70304 [Opn->Ver]: Regex not matching on PHP7

From: Date: Wed, 19 Aug 2015 14:42:28 +0000
Subject: Bug #70304 [Opn->Ver]: Regex not matching on PHP7
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195344@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70304&edit=1 ID: 70304 Updated by: cmb@php.net Reported by: giggsey at gmail dot com Summary: Regex not matching on PHP7 -Status: Open +Status: Verified Type: Bug Package: PCRE related PHP Version: 7.0.0beta3 Block user comment: N Private report: N New Comment: That is somehow related to the PCRE JIT support. When pcre.jit=0, the behavior is as expected, see <https://3v4l.org/ZkeV6>. Previous Comments: ------------------------------------------------------------------------ [2015-08-19 13:22:20] giggsey at gmail dot com Description: ------------ Regex: https://regex101.com/r/aZ7pL6/1 which matches the subject. However, on PHP7 (and HHVM...), the regular expression fails to match anything. If I change the first character matching from '[3-5789]' to '[3-578]', it starts working on PHP7. Demo @ https://3v4l.org/0SMiZ Test script: --------------- <?php $subject = '512345678'; $failingPattern = '/^(?:[3-5789]\d{8})$/x'; $result = preg_match($failingPattern , $subject, $groups, PREG_OFFSET_CAPTURE); var_dump($result, $groups); Expected result: ---------------- int(1) array(1) { [0]=> array(2) { [0]=> string(9) "512345678" [1]=> int(0) } } Actual result: -------------- int(0) array(0) { } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70304&edit=1

« previous php.bugs (#195344) next »