diff --git a/.gitignore b/.gitignore index bd11bfd9d..bfcf19834 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .php_cs.cache +.phpunit.result.cache php-cs-fixer bin composer.lock diff --git a/src/CorruptedPathDetected.php b/src/CorruptedPathDetected.php new file mode 100644 index 000000000..81a27e5f2 --- /dev/null +++ b/src/CorruptedPathDetected.php @@ -0,0 +1,17 @@ +assertEquals(3, Util::contentSize('135')); } + /** + * @dataProvider dbCorruptedPath + */ + public function testRejectingPathWithFunkyWhitespace($path) + { + $this->expectException(CorruptedPathDetected::class); + Util::normalizePath($path); + } + + /** + * @return array + */ + public function dbCorruptedPath() + { + return [["some\0/path.txt"], ["s\x09i.php"]]; + } + public function mapProvider() { return [ @@ -95,7 +112,7 @@ public function invalidPathProvider() } /** - * @dataProvider invalidPathProvider + * @dataProvider invalidPathProvider */ public function testOutsideRootPath($path) { @@ -125,7 +142,6 @@ public function pathProvider() ['example/path/..txt', 'example/path/..txt'], ['\\example\\path.txt', 'example/path.txt'], ['\\example\\..\\path.txt', 'path.txt'], - ["some\0/path.txt", 'some/path.txt'], ]; }