]> granicus.if.org Git - php/commitdiff
Bugfix 23654. If subject is an array and it contains other arrays, we want to pass...
authorSara Golemon <pollita@php.net>
Fri, 16 May 2003 23:24:55 +0000 (23:24 +0000)
committerSara Golemon <pollita@php.net>
Fri, 16 May 2003 23:24:55 +0000 (23:24 +0000)
ext/standard/string.c

index 97356ffc4454fc74614209872dbd84f297ab76e9..fff25c077ead1f4b24f8e46a448d0b1300b9b12e 100644 (file)
@@ -2726,8 +2726,12 @@ PHP_FUNCTION(str_replace)
                /* 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);
+                       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);
+                       } 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)) {