From de85bccf0367f72c91f981a240acddcf348439bd Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Fri, 26 Sep 2003 18:00:00 +0000 Subject: [PATCH] MFH BugFix# 25671 subarray corruption in str_replace --- NEWS | 1 + ext/standard/string.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 97092d13c1..c6e4ada65c 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ PHP 4 NEWS - Fixed crash bug when non-existing save/serializer handler was used. (Jani) - Fixed memory leak in gethostbynamel() if an error occurs. (Sara) - Fixed FastCGI being unable to bind to a specific IP. (Sascha) +- Fixed bug #25671 (str_replace corrupting subarrays). (Sara) - Fixed bug #25648 (xslt_set_encoding() being not detected correctly). (Jani) - Fixed bug #25636 (SNMP Session not closed on success). (Ilia, nesslage[at]mwsc[dot]edu) diff --git a/ext/standard/string.c b/ext/standard/string.c index 0e099dcecf..884f361642 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2746,7 +2746,10 @@ PHP_FUNCTION(str_replace) SEPARATE_ZVAL(subject_entry); php_str_replace_in_subject(*search, *replace, subject_entry, result); } else { - result = *subject_entry; + MAKE_STD_ZVAL(result); + SEPARATE_ZVAL(subject_entry); + *result = **subject_entry; + zval_copy_ctor(result); } /* Add to return array */ switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(subject), &string_key, -- 2.50.1