Bug #71036 [NEW]: When using /x modifier, a "/" in a regex comment is seen as a regex delimiter

From: Date: Sat, 05 Dec 2015 01:26:33 +0000
Subject: Bug #71036 [NEW]: When using /x modifier, a "/" in a regex comment is seen as a regex delimiter
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197602@lists.php.net to get a copy of this message
From: cmanley at xs4all dot nl Operating system: Debian 8.2 PHP version: 5.6.16 Package: PCRE related Bug Type: Bug Bug description:When using /x modifier, a "/" in a regex comment is seen as a regex delimiter Description: ------------ The documentation for the x (PCRE_EXTENDED) modifier states: "characters between an unescaped # outside a character class and the next newline character, inclusive, are also ignored" Yet this is not the case in my test example: The "/" in the regex comment "# firstname/alias" is seen as a regex delimiter. Test script: --------------- <?php $fullname = 'Joe Blow'; if (preg_match('/^ (\S+) # firstname/alias \s+ \S+ # surname $/x', $fullname, $matches)) { print $matches[1] . "\n"; } Expected result: ---------------- Joe Actual result: -------------- PHP Warning: preg_match(): Unknown modifier 'a' in /home/cmanley/t.php on line 8 -- Edit bug report at https://bugs.php.net/bug.php?id=71036&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71036&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71036&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71036&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71036&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71036&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71036&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71036&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71036&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71036&r=support Expected behavior: https://bugs.php.net/fix.php?id=71036&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71036&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71036&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71036&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71036&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71036&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71036&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71036&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71036&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71036&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71036&r=mysqlcfg

« previous php.bugs (#197602) next »