1--TEST-- 2Bug #78863 (DirectoryIterator class silently truncates after a null byte) 3--FILE-- 4<?php 5$dir = __DIR__ . '/bug78863'; 6mkdir($dir); 7touch("$dir/bad"); 8mkdir("$dir/sub"); 9touch("$dir/sub/good"); 10 11$it = new DirectoryIterator(__DIR__ . "/bug78863\0/sub"); 12foreach ($it as $fileinfo) { 13 if (!$fileinfo->isDot()) { 14 var_dump($fileinfo->getFilename()); 15 } 16} 17?> 18--EXPECTF-- 19Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct() expects parameter 1 to be a valid path, string given in %s:%d 20Stack trace: 21#0 %s(%d): DirectoryIterator->__construct('%s') 22#1 {main} 23 thrown in %s on line %d 24--CLEAN-- 25<?php 26$dir = __DIR__ . '/bug78863'; 27unlink("$dir/sub/good"); 28rmdir("$dir/sub"); 29unlink("$dir/bad"); 30rmdir($dir); 31?> 32