1--TEST-- 2Test opendir() function : error conditions - Non-existent directory 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) == 'WIN') { 6 die('skip.. Not valid for 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): failed to open dir: %s in %s on line %d 37bool(false) 38 39-- Pass a non-existent relative path: -- 40 41Warning: opendir(idonotexist): failed to open dir: %s in %s on line %d 42bool(false) 43===DONE=== 44