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.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 3c60a6a3e4..969fce2e9e 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1392,6 +1392,9 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
}
}
if (ZEND_NUM_ARGS() > 4) {
+ if (Z_ISREF_P(zcount)) {
+ zcount = Z_REFVAL_P(zcount);
+ }
zval_dtor(zcount);
ZVAL_LONG(zcount, replace_count);
}