From a90e5f5a6b00362f9e6e52d1e46e032b8d26143a Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Wed, 17 Oct 2001 18:20:19 +0000 Subject: @- Fixed a bug in preg_replace() that would change the type of the replacement @ array entries to string. (Andrei) --- ext/pcre/php_pcre.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ext/pcre/php_pcre.c') diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 381c1b4eed..74caa0f0e9 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -704,7 +704,6 @@ char *php_pcre_replace(char *regex, int regex_len, return NULL; } } else { - convert_to_string(replace_val); replace = Z_STRVAL_P(replace_val); replace_len = Z_STRLEN_P(replace_val); replace_end = replace + replace_len; @@ -906,6 +905,9 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, if (Z_TYPE_P(replace) == IS_ARRAY && !is_callable_replace) { /* Get current entry */ if (zend_hash_get_current_data(Z_ARRVAL_P(replace), (void **)&replace_entry) == SUCCESS) { + if (!is_callable_replace) { + convert_to_string_ex(replace_entry); + } replace_value = *replace_entry; zend_hash_move_forward(Z_ARRVAL_P(replace)); } else { -- cgit v1.2.1