From: Brion Vibber Date: Tue, 3 Oct 2017 22:15:15 +0000 (-0700) Subject: Support uploads with UTF-8 names on Windows X-Git-Tag: 1.31.0-rc.0~1882^2 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=1b04c8a1066b02fcb9ce28bedc8e677aaa28cad9;p=lhc%2Fweb%2Fwiklou.git Support uploads with UTF-8 names on Windows On PHP 7.1 and later, filesystem functions on Windows use the Unicode system functions, which makes our file handling work for non-ASCII file names. Previously this was blacklisted for Windows on all PHP versions. Versions before 7.1 will still reject Unicode filenames with non-ASCII chars. Bug: T3780 Change-Id: I94377faa5185f133be2dfb7b9b6aeacbd582834f --- diff --git a/includes/libs/filebackend/FSFileBackend.php b/includes/libs/filebackend/FSFileBackend.php index 30548ef0c0..b257e27909 100644 --- a/includes/libs/filebackend/FSFileBackend.php +++ b/includes/libs/filebackend/FSFileBackend.php @@ -99,7 +99,13 @@ class FSFileBackend extends FileBackendStore { } public function getFeatures() { - return !$this->isWindows ? FileBackend::ATTR_UNICODE_PATHS : 0; + if ( $this->isWindows && version_compare( PHP_VERSION, '7.1', 'lt' ) ) { + // PHP before 7.1 used 8-bit code page for filesystem paths on Windows; + // See http://php.net/manual/en/migration71.windows-support.php + return 0; + } else { + return FileBackend::ATTR_UNICODE_PATHS; + } } protected function resolveContainerPath( $container, $relStoragePath ) {