From ce149b0cb8ce8983eae3885dd42e9ccbdc650d6e Mon Sep 17 00:00:00 2001 From: Evgeny Stepanischev Date: Mon, 13 Jul 2020 15:16:39 +0300 Subject: [PATCH] Fixed bug #79849 Closes GH-5853. --- ext/standard/string.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index ba66d3c3ac..8cf206533a 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -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); -- 2.40.0