|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-07-27 16:36 UTC] cmb@php.net
-Status: Open
+Status: Analyzed
-Assigned To:
+Assigned To: cmb
[2016-07-27 16:36 UTC] cmb@php.net
[2016-07-27 17:15 UTC] cmb@php.net
[2016-07-27 17:15 UTC] cmb@php.net
-Status: Analyzed
+Status: Closed
[2016-10-17 10:10 UTC] bwoebi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 09:00:01 2025 UTC |
Description: ------------ When I create many named groups in pattern like \(?'group0'foo)|(?'group1'bar)|…\ then the resulting $matches does not show 'group254'. What was supposed to be in `$matches['group254']` is in `$matches['group255']`, and so on. the lack repeats every ~255 named groups and the offset is getting worse and worse. I tested it on php 7 and php 5.5, locally and in online-php-sandbox. Test script: --------------- <?php $pattern = []; for ($i = 0; $i < 300; $i++) { $pattern[] = "(?'group{$i}'{$i}$)"; } $fullPattern = '/' . implode('|', $pattern) . '/uix'; preg_match($fullPattern, '290', $matches); var_dump(isset($matches['group253'])); var_dump(isset($matches['group254'])); var_dump(isset($matches['group255'])); var_dump($matches['group290']); var_dump($matches['group291']); Expected result: ---------------- bool(true) bool(true) bool(true) string(3) "290" string(0) "" Actual result: -------------- bool(true) bool(false) bool(true) string(0) "" string(3) "290"