From 2414b3d7756f7a4937d845fb2cb64947ab6796c8 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 7 May 2020 18:50:42 +0200 Subject: Ensure ctype_string is NULL for C locale We already document that this is the case, but currently it's only true if setlocale() has not been called. Make sure ctype_string is always NULL, even with an explicit "C" locale call, so we can more efficiently check whether we are in the "C" locale. Closes GH-5542. --- ext/pcre/php_pcre.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ext/pcre/php_pcre.c') diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 611a18bd48..9f67bff14c 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -595,8 +595,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in zend_string *key; pcre_cache_entry *ret; - if (locale_aware && BG(ctype_string) && - (ZSTR_LEN(BG(ctype_string)) != 1 && ZSTR_VAL(BG(ctype_string))[0] != 'C')) { + if (locale_aware && BG(ctype_string)) { key = zend_string_concat2( ZSTR_VAL(BG(ctype_string)), ZSTR_LEN(BG(ctype_string)), ZSTR_VAL(regex), ZSTR_LEN(regex)); -- cgit v1.2.1