Skip to content

Commit 15f94e9

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
2 parents dfb3e27 + 40afd77 commit 15f94e9

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

‎NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ PHP NEWS
1818
. Fixed bug #71863 (Segfault when EXPLAIN with "Unknown column" error when
1919
using MariaDB). (Andrey)
2020

21+
- PCRE:
22+
. Fixed bug #72688 (preg_match missing group names in matches). (cmb)
23+
2124
- Reflection:
2225
. Fixed bug #72661 (ReflectionType::__toString crashes with iterable).
2326
(Laruence)

‎ext/pcre/php_pcre.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static char **make_subpats_table(int num_subpats, pcre_cache_entry *pce)
261261

262262
subpat_names = (char **)ecalloc(num_subpats, sizeof(char *));
263263
while (ni++ < name_cnt) {
264-
name_idx = 0xff * (unsigned char)name_table[0] + (unsigned char)name_table[1];
264+
name_idx = 0x100 * (unsigned char)name_table[0] + (unsigned char)name_table[1];
265265
subpat_names[name_idx] = name_table + 2;
266266
if (is_numeric_string(subpat_names[name_idx], strlen(subpat_names[name_idx]), NULL, NULL, 0) > 0) {
267267
php_error_docref(NULL, E_WARNING, "Numeric named subpatterns are not allowed");

‎ext/pcre/tests/bug72688.phpt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Bug #72688 (preg_match missing group names in matches)
3+
--FILE--
4+
<?php
5+
6+
$pattern = [];
7+
for ($i = 0; $i < 300; $i++) {
8+
$pattern[] = "(?'group{$i}'{$i}$)";
9+
}
10+
$fullPattern = '/' . implode('|', $pattern) . '/uix';
11+
12+
preg_match($fullPattern, '290', $matches);
13+
14+
var_dump($matches['group290']);
15+
?>
16+
--EXPECT--
17+
string(3) "290"

0 commit comments

Comments
 (0)