Skip to content

Commit bbfd392

Browse files
committed
test: add test for regex error
1 parent 62b20ac commit bbfd392

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/system/Autoloader/AutoloaderTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Config\Modules;
1818
use Config\Services;
1919
use InvalidArgumentException;
20+
use RuntimeException;
2021
use UnnamespacedClass;
2122

2223
/**
@@ -222,6 +223,16 @@ public function testSanitizationFilenameEdges()
222223
$this->loader->sanitizeFilename($test);
223224
}
224225

226+
public function testSanitizationRegexError()
227+
{
228+
$this->expectException(RuntimeException::class);
229+
$this->expectExceptionMessage('Malformed UTF-8 characters, possibly incorrectly encoded filename:');
230+
231+
$test = mb_convert_encoding('クラスファイル.php', 'EUC-JP', 'UTF-8');
232+
233+
$this->loader->sanitizeFilename($test);
234+
}
235+
225236
public function testSanitizationAllowUnicodeChars()
226237
{
227238
$test = 'Ä/path/to/some/file.php';

0 commit comments

Comments
 (0)