summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r--ext/pcre/php_pcre.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 37e0b0c68b..bdc299806c 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1290,7 +1290,11 @@ matched:
*/
if (count < num_subpats) {
for (; i < num_subpats; i++) {
- if (unmatched_as_null) {
+ if (offset_capture) {
+ add_offset_pair(
+ &match_sets[i], NULL, 0, PCRE2_UNSET,
+ NULL, unmatched_as_null);
+ } else if (unmatched_as_null) {
add_next_index_null(&match_sets[i]);
} else {
add_next_index_str(&match_sets[i], ZSTR_EMPTY_ALLOC());