Bug #70304 [NEW]: Regex not matching on PHP7

From: Date: Wed, 19 Aug 2015 13:22:23 +0000
Subject: Bug #70304 [NEW]: Regex not matching on PHP7
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195336@lists.php.net to get a copy of this message
From: giggsey at gmail dot com Operating system: PHP version: 7.0.0beta3 Package: PCRE related Bug Type: Bug Bug description:Regex not matching on PHP7 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 bug report at https://bugs.php.net/bug.php?id=70304&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70304&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70304&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70304&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70304&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70304&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70304&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70304&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70304&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70304&r=support Expected behavior: https://bugs.php.net/fix.php?id=70304&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70304&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70304&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70304&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70304&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70304&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70304&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70304&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70304&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70304&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70304&r=mysqlcfg

« previous php.bugs (#195336) next »