summaryrefslogtreecommitdiff
path: root/ext/standard/tests/dir/dir_variation5.phpt
blob: ea040bed8a02cc7047c20104d2ec080bb9d0a143 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--TEST--
Test dir() function : usage variations - open a file instead of directory
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
    die('skip.. Not valid for Windows');
}
?>
--FILE--
<?php
/*
 * Prototype  : object dir(string $directory[, resource $context])
 * Description: Directory class with properties, handle and class and methods read, rewind and close
 * Source code: ext/standard/dir.c
 */

/*
 * Passing a file as argument to dir() function instead of a directory
 * and checking if proper warning message is generated.
 */

echo "*** Testing dir() : open a file instead of a directory ***\n";

// open the file instead of directory
$d = dir(__FILE__);
var_dump( $d );

echo "Done";
?>
--EXPECTF--
*** Testing dir() : open a file instead of a directory ***

Warning: dir(%s): failed to open dir: %s in %s on line %d
bool(false)
Done