Bug #76033 [NEW]: some words, preg_match_all can't match big S correctly

From: Date: Thu, 01 Mar 2018 03:29:14 +0000
Subject: Bug #76033 [NEW]: some words, preg_match_all can't match big S correctly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214157@lists.php.net to get a copy of this message
From: master at hiroz dot cn Operating system: macOS 10.12.6 PHP version: 5.6.33 Package: Unknown/Other Function Bug Type: Bug Bug description:some words, preg_match_all can't match big S correctly Description: ------------ preg_match_all can't match \S correctly in php5.4 ~ php5.6.33 ``` $matches = array(); $template = '<p>{{{ 发货单号 }}}</p><p>{{{ 单据123号 }}}</p><p>{{{ 拉包 }}}</p><p>{{{ a }}}</p><p>{{{ a }}}</p>'; $ret = preg_match_all('/\{\{\{ \S+ \}\}\}/', $template, $matches); print_r($matches); ``` result is ``` Array ( [0] => Array ( [0] => {{{ 发货单号 }}} [1] => {{{ 单据123号 }}} [2] => {{{ a }}} [3] => {{{ a }}} ) ) ``` the "拉包" is missing. i try many cases. "包" can't be matched by "\S". but in php5.3 or other languages, "包" can be matched by "\S". Test script: --------------- $matches = array(); $template = '<p>{{{ 发货单号 }}}</p><p>{{{ 单据123号 }}}</p><p>{{{ 拉包 }}}</p><p>{{{ a }}}</p><p>{{{ a }}}</p>'; $ret = preg_match_all('/\{\{\{ \S+ \}\}\}/', $template, $matches); print_r($matches); Expected result: ---------------- Array ( [0] => Array ( [0] => {{{ 发货单号 }}} [1] => {{{ 单据123号 }}} [2] => {{{ 拉包 }}} [3] => {{{ a }}} [4] => {{{ a }}} ) ) Actual result: -------------- Array ( [0] => Array ( [0] => {{{ 发货单号 }}} [1] => {{{ 单据123号 }}} [2] => {{{ a }}} [3] => {{{ a }}} ) ) -- Edit bug report at https://bugs.php.net/bug.php?id=76033&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76033&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76033&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76033&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76033&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76033&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76033&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76033&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76033&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76033&r=support Expected behavior: https://bugs.php.net/fix.php?id=76033&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76033&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76033&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76033&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76033&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76033&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76033&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76033&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76033&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76033&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76033&r=mysqlcfg

« previous php.bugs (#214157) next »