From: Thies C. Arntzen Date: Sun, 14 Nov 1999 17:20:56 +0000 (+0000) Subject: @- ucfirst()/ucwords() no longer modify arg1. (Thies) X-Git-Tag: php-4.0b3_RC5~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4127b34a0a586f3b2e675e55c913dd18477398cb;p=php @- ucfirst()/ucwords() no longer modify arg1. (Thies) (PHP ucfirst,ucwords) no longer modify arg1 --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 13a563ff36..37e8472595 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -937,8 +937,10 @@ PHP_FUNCTION(ucfirst) if (!*(*arg)->value.str.val) { RETURN_FALSE; } - *(*arg)->value.str.val = toupper((unsigned char)*(*arg)->value.str.val); - RETVAL_STRING((*arg)->value.str.val,1); + + *return_value=**arg; + zval_copy_ctor(return_value); + *return_value->value.str.val = toupper((unsigned char)*return_value->value.str.val); } /* }}} */ @@ -957,8 +959,11 @@ PHP_FUNCTION(ucwords) if (!*(*arg)->value.str.val) { RETURN_FALSE; } - *(*arg)->value.str.val = toupper((unsigned char)*(*arg)->value.str.val); - r=(*arg)->value.str.val; + *return_value=**arg; + zval_copy_ctor(return_value); + *return_value->value.str.val = toupper((unsigned char)*return_value->value.str.val); + + r=return_value->value.str.val; while((r=strstr(r," "))){ if(*(r+1)){ r++; @@ -967,7 +972,6 @@ PHP_FUNCTION(ucwords) break; } } - RETVAL_STRING((*arg)->value.str.val,1); } /* }}} */