diff options
author | Andrei Zmievski <andrei@php.net> | 2001-10-17 18:20:19 +0000 |
---|---|---|
committer | Andrei Zmievski <andrei@php.net> | 2001-10-17 18:20:19 +0000 |
commit | a90e5f5a6b00362f9e6e52d1e46e032b8d26143a (patch) | |
tree | 8bec3d60a59eb7a8c5e6821d30f6c79d8d37c051 /ext/pcre/php_pcre.c | |
parent | 67e663efbfc50baeab3d9ce7cb7c1d62d85c973a (diff) | |
download | php-git-a90e5f5a6b00362f9e6e52d1e46e032b8d26143a.tar.gz |
@- Fixed a bug in preg_replace() that would change the type of the replacement
@ array entries to string. (Andrei)
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 { |