summaryrefslogtreecommitdiff
path: root/ext/standard/string.c
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-05-16 23:30:08 +0000
committerSara Golemon <pollita@php.net>2003-05-16 23:30:08 +0000
commit89243957203d8bfc14687225f24614798cb0e5f9 (patch)
tree5a9df64e8a851a8e48e8afdf270dd0419237a17c /ext/standard/string.c
parentb67f2dc98dcf88d319bffdbd1bc07aa97b97beef (diff)
downloadphp-git-89243957203d8bfc14687225f24614798cb0e5f9.tar.gz
MFB(r-1.333.2.27) Bugfix 23654. If subject is an array and it contains other arrays, we want to pass those subarrays through unchanged rather than attempt to convert them to string.
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r--ext/standard/string.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index a61814e16a..ae9f8da38d 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3162,8 +3162,12 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
/* For each subject entry, convert it to string, then perform replacement
and add the result to the return_value array. */
while (zend_hash_get_current_data(Z_ARRVAL_PP(subject), (void **)&subject_entry) == SUCCESS) {
- MAKE_STD_ZVAL(result);
- php_str_replace_in_subject(*search, *replace, subject_entry, result, case_sensitivity, (argc > 3) ? &count : NULL);
+ if (Z_TYPE_PP(subject_entry) != IS_ARRAY && Z_TYPE_PP(subject_entry) != IS_OBJECT) {
+ MAKE_STD_ZVAL(result);
+ php_str_replace_in_subject(*search, *replace, subject_entry, result, case_sensitivity, (argc > 3) ? &count : NULL);
+ } else {
+ result = *subject_entry;
+ }
/* Add to return array */
switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(subject), &string_key,
&string_key_len, &num_key, 0, NULL)) {