1--TEST--
2Test scandir() 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  : 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 = __DIR__ . '/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): failed to open dir: %s in %s on line %d
37
38Warning: scandir(): (errno %d): %s in %s on line %d
39bool(false)
40
41-- Pass scandir() a relative path that does not exist --
42
43Warning: scandir(/idonotexist): failed to open dir: %s in %s on line %d
44
45Warning: scandir(): (errno %d): %s in %s on line %d
46bool(false)
47===DONE===
48