1--TEST-- 2Test opendir() function : error conditions - Non-existent directory 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) != 'WIN') { 6 die("skip Valid only on Windows"); 7} 8?> 9--FILE-- 10<?php 11/* Prototype : mixed opendir(string $path[, resource $context]) 12 * Description: Open a directory and return a dir_handle 13 * Source code: ext/standard/dir.c 14 */ 15 16/* 17 * Pass a non-existent directory as $path argument to opendir() to test behaviour 18 */ 19 20echo "*** Testing opendir() : error conditions ***\n"; 21 22echo "\n-- Pass a non-existent absolute path: --\n"; 23$path = dirname(__FILE__) . "/idonotexist"; 24var_dump(opendir($path)); 25 26echo "\n-- Pass a non-existent relative path: --\n"; 27chdir(dirname(__FILE__)); 28var_dump(opendir('idonotexist')); 29?> 30===DONE=== 31--EXPECTF-- 32*** Testing opendir() : error conditions *** 33 34-- Pass a non-existent absolute path: -- 35 36Warning: opendir(%s/idonotexist,%s/idonotexist): The system cannot find the file specified. (code: %d) in %s on line %d 37 38Warning: opendir(%s/idonotexist): failed to open dir: %s in %s on line %d 39bool(false) 40 41-- Pass a non-existent relative path: -- 42 43Warning: opendir(idonotexist,idonotexist): The system cannot find the file specified. (code: %d) in %s on line %d 44 45Warning: opendir(idonotexist): failed to open dir: %s in %s on line %d 46bool(false) 47===DONE=== 48