summaryrefslogtreecommitdiff
path: root/main/main.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-04-29 11:51:50 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-04-30 10:22:51 +0200
commitc4ad8beaa890b931031a5cf8a1d2d38550fca3af (patch)
tree05f544910ba3b8cc118fea231bce172d921c2cf1 /main/main.c
parent707cb18276b3d344e37535b82359a797d285c35b (diff)
downloadphp-git-c4ad8beaa890b931031a5cf8a1d2d38550fca3af.tar.gz
Do not inherit LC_CTYPE locale from environment
Treatment of locales in PHP is currently inconsistent: The LC_ALL locale is set to "C", as is standard behavior on program startup. The LC_CTYPE locale is set to "", which will inherit it from the environment. However, the inherited LC_CTYPE locale will only be used in some cases, while in other cases it is necessary to perform an explicit setlocale() call in PHP first. This is the case for the locale-sensitive handling in the PCRE extension. Make things consistent by *never* inheriting any locales from the environment. LC_ALL, including LC_CTYPE will be "C" on startup. A locale can be set or inherited through an explicit setlocale() call, at which point the behavior will be fully consistent and predictable. Closes GH-5488.
Diffstat (limited to 'main/main.c')
-rw-r--r--main/main.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/main/main.c b/main/main.c
index 3a1e92ee08..dc9182e481 100644
--- a/main/main.c
+++ b/main/main.c
@@ -2133,7 +2133,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
zuf.getenv_function = sapi_getenv;
zuf.resolve_path_function = php_resolve_path_for_zend;
zend_startup(&zuf);
- setlocale(LC_CTYPE, "");
zend_update_current_locale();
#if HAVE_TZSET