Bug #73762 [NEW]: recursive pattern breaks from pcre 8.3.36
| From: | zhihong dot chen dot cn at gmail dot com | Date: | Fri, 16 Dec 2016 16:52:00 +0000 |
| Subject: | Bug #73762 [NEW]: recursive pattern breaks from pcre 8.3.36 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-206073@lists.php.net to get a copy of this message | ||
From: zhihong dot chen dot cn at gmail dot com
Operating system: Ubuntu 14.04.5 X64
PHP version: 7.0.14
Package: PCRE related
Bug Type: Bug
Bug description:recursive pattern breaks from pcre 8.3.36
Description:
------------
From php 5.6.9 after pcre upgrade to 8.37 and later.
Recursive matching breaks. generate different result.
when using php 5.6.8 and before version
Will generate expect result.
Later version will generate incorrect result.
Test script:
---------------
<?PHP
const pattern =
"#\{(?:(?<name>\w+))(?:/\}|\}(?<snippet>(?:[^{]*|(?!\{\w+:\})++|(?R))*+)\{end\})#mu";
$ss = <<<'EOD'
{first} {second}within second{end} {end}
EOD;
function testRun($input ){
echo $input[0];
echo PHP_EOL;
}
preg_replace_callback( pattern ,'testRun',$ss);
Expected result:
----------------
{first} {second}within second{end} {end}
Actual result:
--------------
{second}within second{end}
--
Edit bug report at https://bugs.php.net/bug.php?id=73762&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73762&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73762&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73762&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73762&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73762&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73762&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73762&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73762&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73762&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73762&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73762&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73762&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73762&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73762&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73762&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73762&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73762&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73762&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73762&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73762&r=mysqlcfg