[php-src] PR #22029: ext/pcre: fix duplicate MARK key in matches array
| From: | iliaal | Date: | Tue, 12 May 2026 22:39:47 +0000 |
| Subject: | [php-src] PR #22029: ext/pcre: fix duplicate MARK key in matches array | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36111@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22029
Author: iliaal
Regression from d6cc31cf9538: populate_subpat_array() now uses zend_hash_str_add_new for the
(*MARK:name) directive, which skips the duplicate-key check. When a named capture is also called
MARK, two buckets land in $matches.
Repro:
preg_match('/(?P<MARK>[abc])(*MARK:value)/', "abc",
$m);. Master gives count($m)==4 with a duplicate JSON key; PHP-8.4 gives 3. Restore the
directive-overwrites-capture behavior that add_assoc_string_ex provided before the refactor.