]> granicus.if.org Git - php/commitdiff
@- Fixed strtr() not to modify arg1. (Thies)
authorThies C. Arntzen <thies@php.net>
Sun, 14 Nov 1999 15:34:50 +0000 (15:34 +0000)
committerThies C. Arntzen <thies@php.net>
Sun, 14 Nov 1999 15:34:50 +0000 (15:34 +0000)
(PHP strtr) no longer modifies arg1.

ext/standard/string.c

index d208c6ad9bdeedba8e93cdd8ca369b8bb223b290..13a563ff36fd2c5f34f7eda980e4098c25784510 100644 (file)
@@ -1008,12 +1008,13 @@ PHP_FUNCTION(strtr)
        convert_to_string_ex(from);
        convert_to_string_ex(to);
 
-       RETVAL_STRING(php_strtr((*str)->value.str.val,
-                                                       (*str)->value.str.len,
-                                                       (*from)->value.str.val,
-                                                       (*to)->value.str.val,
-                                                       MIN((*from)->value.str.len,(*to)->value.str.len)),
-                                 1);
+       *return_value=**str;
+       zval_copy_ctor(return_value);                                                                                        
+       php_strtr(return_value->value.str.val,
+                         return_value->value.str.len,
+                         (*from)->value.str.val,
+                         (*to)->value.str.val,
+                         MIN((*from)->value.str.len,(*to)->value.str.len));
 }
 /* }}} */