diff options
Diffstat (limited to 'ext/spl/tests/bug78863.phpt')
-rw-r--r-- | ext/spl/tests/bug78863.phpt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ext/spl/tests/bug78863.phpt b/ext/spl/tests/bug78863.phpt new file mode 100644 index 0000000000..dc88d98dee --- /dev/null +++ b/ext/spl/tests/bug78863.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #78863 (DirectoryIterator class silently truncates after a null byte) +--FILE-- +<?php +$dir = __DIR__ . '/bug78863'; +mkdir($dir); +touch("$dir/bad"); +mkdir("$dir/sub"); +touch("$dir/sub/good"); + +$it = new DirectoryIterator(__DIR__ . "/bug78863\0/sub"); +foreach ($it as $fileinfo) { + if (!$fileinfo->isDot()) { + var_dump($fileinfo->getFilename()); + } +} +?> +--EXPECTF-- +Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct() expects parameter 1 to be a valid path, string given in %s:%d +Stack trace: +#0 %s(%d): DirectoryIterator->__construct('%s') +#1 {main} + thrown in %s on line %d +--CLEAN-- +<?php +$dir = __DIR__ . '/bug78863'; +unlink("$dir/sub/good"); +rmdir("$dir/sub"); +unlink("$dir/bad"); +rmdir($dir); +?> |