Skip to content

Commit ce149b0

Browse files
bolknotenikic
authored andcommitted
Fixed bug #79849
Closes GH-5853.
1 parent f0b2c2c commit ce149b0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/standard/string.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2823,8 +2823,9 @@ PHP_FUNCTION(chr)
28232823
Uppercase the first character of the word in a native string */
28242824
static zend_string* php_ucfirst(zend_string *str)
28252825
{
2826-
unsigned char r = toupper(ZSTR_VAL(str)[0]);
2827-
if (r == ZSTR_VAL(str)[0]) {
2826+
const unsigned char ch = ZSTR_VAL(str)[0];
2827+
unsigned char r = toupper(ch);
2828+
if (r == ch) {
28282829
return zend_string_copy(str);
28292830
} else {
28302831
zend_string *s = zend_string_init(ZSTR_VAL(str), ZSTR_LEN(str), 0);

0 commit comments

Comments
 (0)