--TEST-- Test scandir() function : usage variations - different directory permissions --SKIPIF-- --FILE-- sub_dir ( sub parent ) * |-> child_dir ( child dir) */ $parent_dir_path = __DIR__ . "/scandir_variation5"; mkdir($parent_dir_path); chmod($parent_dir_path, 0777); // create sub_dir $sub_dir_path = $parent_dir_path . "/sub_dir"; mkdir($sub_dir_path); chmod($sub_dir_path, 0777); //create sub_sub_dir $child_dir_path = $sub_dir_path."/child_dir"; mkdir($child_dir_path); // remove the write and execute permisson from sub parent chmod($sub_dir_path, 0444); echo "\n-- After restricting 1st level parent directory --\n"; var_dump(scandir($child_dir_path)); // remove the execute permisson from parent dir, allowing all permission for sub dir chmod($sub_dir_path, 0777); // all permisson to sub dir chmod($parent_dir_path, 0666); // restricting parent directory echo "\n-- After restricting parent directory --\n"; var_dump(scandir($child_dir_path)); ?> ===DONE=== --CLEAN-- --EXPECTF-- *** Testing scandir() : usage variations *** -- After restricting 1st level parent directory -- Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d Warning: scandir(): (errno %d): %s in %s on line %d bool(false) -- After restricting parent directory -- Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d Warning: scandir(): (errno %d): %s in %s on line %d bool(false) ===DONE===