summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThies C. Arntzen <thies@php.net>1999-11-14 17:20:56 +0000
committerThies C. Arntzen <thies@php.net>1999-11-14 17:20:56 +0000
commit4127b34a0a586f3b2e675e55c913dd18477398cb (patch)
tree229994a778557182b791ed663718b8e68b2b26e3
parentf2b0c70512108ef86b84aa7e6503211eb7574473 (diff)
downloadphp-git-4127b34a0a586f3b2e675e55c913dd18477398cb.tar.gz
@- ucfirst()/ucwords() no longer modify arg1. (Thies)
(PHP ucfirst,ucwords) no longer modify arg1
-rw-r--r--ext/standard/string.c14
1 files changed, 9 insertions, 5 deletions
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);
}
/* }}} */