1--TEST--
2Test scandir() 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  : 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
20echo "*** Testing scandir() : error conditions ***\n";
21
22$directory = dirname(__FILE__) . '/idonotexist';
23
24echo "\n-- Pass scandir() an absolute path that does not exist --\n";
25var_dump(scandir($directory));
26
27echo "\n-- Pass scandir() a relative path that does not exist --\n";
28var_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
36Warning: scandir(%s/idonotexist,%s/idonotexist): The system cannot find the file specified. (code: 2) in %s on line %d
37
38Warning: scandir(%s/idonotexist): failed to open dir: %s in %s on line %d
39
40Warning: scandir(): (errno %d): %s in %s on line %d
41bool(false)
42
43-- Pass scandir() a relative path that does not exist --
44
45Warning: scandir(/idonotexist,/idonotexist): The system cannot find the file specified. (code: 2) in %s on line %d
46
47Warning: scandir(/idonotexist): failed to open dir: %s in %s on line %d
48
49Warning: scandir(): (errno %d): %s in %s on line %d
50bool(false)
51===DONE===
52