From 412ca11eda7f15415f1bca0cf72e15f125ce404d Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 16 Mar 2014 08:45:43 +0800 Subject: [PATCH] Fixed reference arg hanlding in pcre_replace --- ext/pcre/php_pcre.c | 3 +++ 1 file changed, 3 insertions(+) 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); } -- 2.40.0