[php-src] master: pcre: pass subject as zend_string* to preg_do_repl_func()
| From: | Gina Peter Banyard | Date: | Wed, 23 Sep 2026 14:22:34 +0000 |
| Subject: | [php-src] master: pcre: pass subject as zend_string* to preg_do_repl_func() | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141476@lists.php.net to get a copy of this message | ||
Author: Gina Peter Banyard (Girgias)
Date: 2026-09-23T15:22:04+01:00
Commit: https://github.com/php/php-src/commit/fa60d5022f952e6a7fc9340a7db9e728a181f261
Raw diff: https://github.com/php/php-src/commit/fa60d5022f952e6a7fc9340a7db9e728a181f261.diff
pcre: pass subject as zend_string* to preg_do_repl_func()
Changed paths:
M ext/pcre/php_pcre.c
Diff:
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 088db5d7bef2..4c63ab0920ae 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1553,14 +1553,14 @@ static bool preg_get_backref(char **str, int *backref)
}
/* Return NULL if an exception has occurred */
-static zend_string *preg_do_repl_func(zend_fcall_info *fci, zend_fcall_info_cache *fcc, const char
*subject, PCRE2_SIZE *offsets, zend_string **subpat_names, uint32_t num_subpats, int count, const
PCRE2_SPTR mark, zend_long flags)
+static zend_string *preg_do_repl_func(zend_fcall_info *fci, zend_fcall_info_cache *fcc, const
zend_string *subject, PCRE2_SIZE *offsets, zend_string **subpat_names, uint32_t num_subpats, int
count, const PCRE2_SPTR mark, zend_long flags)
{
zend_string *result_str = NULL;
zval retval; /* Function return value */
zval arg; /* Argument to pass to function */
array_init_size(&arg, count + (mark ? 1 : 0));
- populate_subpat_array(Z_ARRVAL(arg), subject, offsets, subpat_names, num_subpats, count, mark,
flags);
+ populate_subpat_array(Z_ARRVAL(arg), ZSTR_VAL(subject), offsets, subpat_names, num_subpats, count,
mark, flags);
fci->retval = &retval;
fci->param_count = 1;
@@ -1952,7 +1952,7 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce,
zend_strin
/* Use custom function to get replacement string and its length. */
zend_string *eval_result = preg_do_repl_func(
- fci, fcc, ZSTR_VAL(subject_str), offsets, subpat_names, num_subpats, count,
+ fci, fcc, subject_str, offsets, subpat_names, num_subpats, count,
pcre2_get_mark(match_data), flags);
if (UNEXPECTED(eval_result == NULL)) {