Return to scandir_error2.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / dir |
1.1 misho 1: --TEST-- 2: Test scandir() function : error conditions - Non-existent directory 1.1.1.2 ! misho 3: --SKIPIF-- ! 4: <?php ! 5: if (substr(PHP_OS, 0, 3) == 'WIN') { ! 6: die('skip.. Not valid for Windows'); ! 7: } ! 8: ?> 1.1 misho 9: --FILE-- 10: <?php 11: /* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) 12: * Description: List files & directories inside the specified path 13: * Source code: ext/standard/dir.c 14: */ 15: 16: /* 17: * Pass a directory that does not exist to scandir() to test error messages 18: */ 19: 20: echo "*** Testing scandir() : error conditions ***\n"; 21: 22: $directory = dirname(__FILE__) . '/idonotexist'; 23: 24: echo "\n-- Pass scandir() an absolute path that does not exist --\n"; 25: var_dump(scandir($directory)); 26: 27: echo "\n-- Pass scandir() a relative path that does not exist --\n"; 28: var_dump(scandir('/idonotexist')); 29: ?> 30: ===DONE=== 31: --EXPECTF-- 32: *** Testing scandir() : error conditions *** 33: 34: -- Pass scandir() an absolute path that does not exist -- 35: 36: Warning: scandir(%s/idonotexist): failed to open dir: %s in %s on line %d 37: 38: Warning: scandir(): (errno %d): %s in %s on line %d 39: bool(false) 40: 41: -- Pass scandir() a relative path that does not exist -- 42: 43: Warning: scandir(/idonotexist): failed to open dir: %s in %s on line %d 44: 45: Warning: scandir(): (errno %d): %s in %s on line %d 46: bool(false) 47: ===DONE===