1--TEST--
2Test glob() function with relative path
3--FILE--
4<?php
5/* Prototype: array glob ( string $pattern [, int $flags] );
6   Description: Find pathnames matching a pattern
7*/
8
9$file_path = dirname(__FILE__);
10
11// temp dirname used here
12$dir_name = 'glob_test';
13
14// create temp directory
15mkdir("$file_path/$dir_name");
16
17// create temp file
18$fp = fopen("$file_path/$dir_name/file.text", "w");
19fclose($fp);
20
21echo "Testing glob() with relative paths:\n";
22
23chdir("$file_path/$dir_name");
24var_dump( glob("./*") );
25var_dump( glob("../$dir_name/*"));
26
27chdir("$file_path");
28var_dump( glob("$dir_name/*"));
29var_dump( glob("$dir_name"));
30
31echo "Done\n";
32?>
33--CLEAN--
34<?php
35$file_path = dirname(__FILE__);
36unlink("$file_path/glob_test/file.text");
37rmdir("$file_path/glob_test/");
38?>
39--EXPECT--
40Testing glob() with relative paths:
41array(1) {
42  [0]=>
43  string(11) "./file.text"
44}
45array(1) {
46  [0]=>
47  string(22) "../glob_test/file.text"
48}
49array(1) {
50  [0]=>
51  string(19) "glob_test/file.text"
52}
53array(1) {
54  [0]=>
55  string(9) "glob_test"
56}
57Done
58