]> granicus.if.org Git - php/commitdiff
be stupid, but at least be smart about being stupid.
authorSterling Hughes <sterling@php.net>
Wed, 21 May 2003 17:38:17 +0000 (17:38 +0000)
committerSterling Hughes <sterling@php.net>
Wed, 21 May 2003 17:38:17 +0000 (17:38 +0000)
ext/standard/string.c

index 020eb430b33b1d758b03be5bf67d74b6fe231638..5fac07cf70219c04ad9208e535655ebbb8ee471e 100644 (file)
@@ -836,8 +836,15 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value)
        zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos);
 
        while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **) &tmp, &pos) == SUCCESS) {
-               convert_to_string_ex(tmp);
-
+               if ((*tmp)->type != IS_STRING) {
+                       if (PZVAL_IS_REF(*tmp)) {
+                               SEPARATE_ZVAL(tmp);
+                               convert_to_string(*tmp);
+                       } else {
+                               convert_to_string_ex(tmp);
+                       }
+               } 
+               
                smart_str_appendl(&implstr, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
                if (++i != numelems) {
                        smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRLEN_P(delim));