Skip to content

Commit

Permalink
Fixed bug #79849
Browse files Browse the repository at this point in the history
Closes GH-5853.
  • Loading branch information
bolknote authored and nikic committed Jul 14, 2020
1 parent f0b2c2c commit ce149b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/standard/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ce149b0

Please sign in to comment.