From: Timo Tijhof Date: Sat, 13 Jul 2019 00:46:56 +0000 (+0100) Subject: Setup: Move mb_internal_encoding() call earlier X-Git-Tag: 1.34.0-rc.0~1031^2 X-Git-Url: https://git.cyclocoop.org/%2C?a=commitdiff_plain;h=6612e4867f60fc1a8bced67bcf7489d24e2db675;p=lhc%2Fweb%2Fwiklou.git Setup: Move mb_internal_encoding() call earlier This is an unconditional and unconfigurable changes to PHP behaviour. The earlier the better so that there is less code that can run without it. Also improve some documentation of other setup logic bits being documented by the referenced task. Bug: T189966 Change-Id: Ia8e1478cf0841d80b1c61c266f2ece75be2303e1 --- diff --git a/includes/Setup.php b/includes/Setup.php index 641f1f9030..f34b176e68 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -55,7 +55,7 @@ if ( ini_get( 'mbstring.func_overload' ) ) { // Start the autoloader, so that extensions can derive classes from core files require_once "$IP/includes/AutoLoader.php"; -// Load up some global defines +// Load global constants require_once "$IP/includes/Defines.php"; // Load default settings @@ -89,9 +89,17 @@ if ( !interface_exists( 'Psr\Log\LoggerInterface' ) ) { die( 1 ); } +/** + * Changes to the PHP environment that don't vary on configuration. + */ + // Install a header callback MediaWiki\HeaderCallback::register(); +// Set the encoding used by reading HTTP input, writing HTTP output. +// This is also the default for mbstring functions. +mb_internal_encoding( 'UTF-8' ); + /** * Load LocalSettings.php */ @@ -128,8 +136,6 @@ ExtensionRegistry::getInstance()->loadFromQueue(); // Don't let any other extensions load ExtensionRegistry::getInstance()->finish(); -mb_internal_encoding( 'UTF-8' ); - // Set the configured locale on all requests for consisteny putenv( "LC_ALL=$wgShellLocale" ); setlocale( LC_ALL, $wgShellLocale ); @@ -754,6 +760,8 @@ Profiler::instance()->scopedProfileOut( $ps_default2 ); $ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc' ); // Raise the memory limit if it's too low +// Note, this makes use of wfDebug, and thus should not be before +// MWDebug::init() is called. wfMemoryLimit(); /**