|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-12-17 05:13 UTC] requinix@php.net
-Summary: recursive pattern breaks from pcre 8.3.36
+Summary: recursive pattern breaks from pcre 8.36 to 8.37
-Status: Open
+Status: Not a bug
[2016-12-17 05:13 UTC] requinix@php.net
[2016-12-17 05:14 UTC] requinix@php.net
-PHP Version: 7.0.14
+PHP Version: 5.6.9
[2016-12-17 09:17 UTC] zhihong dot chen dot cn at gmail dot com
[2016-12-17 15:11 UTC] zhihong dot chen dot cn at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Fri Jan 02 06:00:01 2026 UTC |
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}