expectException(CorruptedPathDetected::class); (new WhitespacePathNormalizer)->normalizePath($path); } /** * @return array */ public static function corruptedPaths(): array { return [ 'control character' => ["avatars/user\x00.svg"], 'malformed UTF-8' => ["avatars/user\xFF.svg"], 'control character hidden by malformed UTF-8' => ["avatars/user\xFF\x00.svg"], ]; } public function test_valid_unicode_paths_remain_supported(): void { $this->assertSame( 'avatars/benützer.svg', (new WhitespacePathNormalizer)->normalizePath('./avatars//benützer.svg'), ); } }