1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 01:18:19 +02:00
Closes GH-5853.
This commit is contained in:
Evgeny Stepanischev
2020-07-13 15:16:39 +03:00
committed by Nikita Popov
parent f0b2c2cb98
commit ce149b0cb8
+3 -2
View File
@@ -2823,8 +2823,9 @@ PHP_FUNCTION(chr)
Uppercase the first character of the word in a native string */
static zend_string* php_ucfirst(zend_string *str)
{
unsigned char r = toupper(ZSTR_VAL(str)[0]);
if (r == ZSTR_VAL(str)[0]) {
const unsigned char ch = ZSTR_VAL(str)[0];
unsigned char r = toupper(ch);
if (r == ch) {
return zend_string_copy(str);
} else {
zend_string *s = zend_string_init(ZSTR_VAL(str), ZSTR_LEN(str), 0);