diff options
author | Christoph M. Becker <cmb@php.net> | 2016-07-27 18:59:40 +0200 |
---|---|---|
committer | Christoph M. Becker <cmb@php.net> | 2016-07-27 19:00:38 +0200 |
commit | 40afd77826e19023df3f095525956f713bf0d96f (patch) | |
tree | 6385f9695ff11db25fe6073d918f0e3224a99855 /ext | |
parent | 5513f00a972d1781349035cc097971fb9056cce1 (diff) | |
parent | 315c0536c20619478fc548b782132cd65286018f (diff) | |
download | php-git-40afd77826e19023df3f095525956f713bf0d96f.tar.gz |
Merge branch 'PHP-5.6' into PHP-7.0
# Resolved conflicts:
# ext/pcre/php_pcre.c
Diffstat (limited to 'ext')
-rw-r--r-- | ext/pcre/php_pcre.c | 2 | ||||
-rw-r--r-- | ext/pcre/tests/bug72688.phpt | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 3d59b77005..fe6b7b3984 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -261,7 +261,7 @@ static char **make_subpats_table(int num_subpats, pcre_cache_entry *pce) subpat_names = (char **)ecalloc(num_subpats, sizeof(char *)); while (ni++ < name_cnt) { - name_idx = 0xff * (unsigned char)name_table[0] + (unsigned char)name_table[1]; + name_idx = 0x100 * (unsigned char)name_table[0] + (unsigned char)name_table[1]; subpat_names[name_idx] = name_table + 2; if (is_numeric_string(subpat_names[name_idx], strlen(subpat_names[name_idx]), NULL, NULL, 0) > 0) { php_error_docref(NULL, E_WARNING, "Numeric named subpatterns are not allowed"); diff --git a/ext/pcre/tests/bug72688.phpt b/ext/pcre/tests/bug72688.phpt new file mode 100644 index 0000000000..715743c73d --- /dev/null +++ b/ext/pcre/tests/bug72688.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #72688 (preg_match missing group names in matches) +--FILE-- +<?php + +$pattern = []; +for ($i = 0; $i < 300; $i++) { + $pattern[] = "(?'group{$i}'{$i}$)"; +} +$fullPattern = '/' . implode('|', $pattern) . '/uix'; + +preg_match($fullPattern, '290', $matches); + +var_dump($matches['group290']); +?> +--EXPECT-- +string(3) "290" |