diff options
author | Naoto Kobayashi <naoto.kobayashi4c@gmail.com> | 2021-11-14 00:58:36 +0900 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-11-16 17:52:17 +0000 |
commit | 7e80182e75144bd656f246920ab191faf4bba8b1 (patch) | |
tree | 6539934b87987db96bb985e0cf699e3b26df24ed /tests/lib | |
parent | a80d49a0e7a86aed86fba91086117c55ee210b9c (diff) | |
download | nextcloud-server-7e80182e75144bd656f246920ab191faf4bba8b1.tar.gz nextcloud-server-7e80182e75144bd656f246920ab191faf4bba8b1.zip |
Fix missing setlocale with php 8
When php version = 8, basename('§') does not bug even if LC_ALL is non-UTF-8 locale.
This cause OC_Util::isSetLocaleWorking() to skip setlocale("C.UTF-8").
Fix it by using escapeshellcmd instead of basename.
Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/UtilTest.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index 04d4858fb26..b9c791735bb 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -74,6 +74,14 @@ class UtilTest extends \Test\TestCase { $this->assertEquals("/%C2%A7%23%40test%25%26%5E%C3%A4/-child", $result); } + public function testIsSetLocaleWorking() { + // OC_Util::isSetLocaleWorking() assumes escapeshellcmd('§') returns '' with non-UTF-8 locale. + $locale = setlocale(LC_CTYPE, 0); + setlocale(LC_CTYPE, 'C'); + $this->assertEquals('', escapeshellcmd('§')); + setlocale(LC_CTYPE, $locale); + } + public function testFileInfoLoaded() { $expected = function_exists('finfo_open'); $this->assertEquals($expected, \OC_Util::fileInfoLoaded()); |