summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-01-09 10:30:00 +0300
committerDmitry Stogov <dmitry@zend.com>2018-01-09 10:30:00 +0300
commitcfee682802a93540c3533d404a740efbccbf66c2 (patch)
tree4a97c0bf74a87d554cbcd296206dfecb3f944834
parentfc6a9908911697c48da9810e1fca965f61694fc2 (diff)
downloadphp-git-cfee682802a93540c3533d404a740efbccbf66c2.tar.gz
Fixed possible incorrect "mark" usage
-rw-r--r--ext/pcre/php_pcre.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 64b7077edb..4cdd8bf27c 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1684,6 +1684,11 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_strin
advance to the next character. */
g_notempty = (start_offset == offsets[0]) ? PCRE_NOTEMPTY_ATSTART | PCRE_ANCHORED : 0;
+#ifdef PCRE_EXTRA_MARK
+ /* replace function may use the same regex recursively */
+ extra->mark = &mark;
+ extra->flags |= PCRE_EXTRA_MARK;
+#endif
} else if (count == PCRE_ERROR_NOMATCH || limit == 0) {
/* If we previously set PCRE_NOTEMPTY_ATSTART after a null match,
this is not necessarily the end. We need to advance