1--TEST--
2Test gzfile() function : variation: use include path (relative directories in path)
3--SKIPIF--
4<?php
5if (!extension_loaded("zlib")) {
6    print "skip - ZLIB extension not loaded";
7}
8?>
9--FILE--
10<?php
11$testName = 'gzfile_variation15';
12require_once('reading_include_path.inc');
13
14//define the files to go into these directories, create one in dir2
15set_include_path($newIncludePath);
16test_gzfile();
17
18// remove the directory structure
19chdir($baseDir);
20rmdir($workingDir);
21foreach($newdirs as $newdir) {
22   rmdir($newdir);
23}
24
25chdir("..");
26rmdir($thisTestDir);
27
28function test_gzfile() {
29   global $scriptFile, $secondFile, $firstFile, $filename;
30
31   // create a file in the middle directory
32   $h = gzopen($secondFile, "w");
33   gzwrite($h, "This is a file in dir2");
34   gzclose($h);
35
36   // should read dir2 file
37   var_dump(gzfile($filename, true));
38   echo "\n";
39
40   //create a file in dir1
41   $h = gzopen($firstFile, "w");
42   gzwrite($h, "This is a file in dir1");
43   gzclose($h);
44
45   //should now read dir1 file
46   var_dump(gzfile($filename, true));
47   echo "\n";
48
49   // create a file in working directory
50   $h = gzopen($filename, "w");
51   gzwrite($h, "This is a file in working dir");
52   gzclose($h);
53
54   //should still read dir1 file
55   var_dump(gzfile($filename, true));
56   echo "\n";
57
58   unlink($firstFile);
59   unlink($secondFile);
60
61   //should read the file in working directory
62   var_dump(gzfile($filename, true));
63   echo "\n";
64
65   // create a file in the script directory
66   $h = gzopen($scriptFile, "w");
67   gzwrite($h, "This is a file in script dir");
68   gzclose($h);
69
70   //should read the file in script dir
71   var_dump(gzfile($filename, true));
72   echo "\n";
73
74   //cleanup
75   unlink($filename);
76   unlink($scriptFile);
77
78}
79
80?>
81--EXPECT--
82array(1) {
83  [0]=>
84  string(22) "This is a file in dir2"
85}
86
87array(1) {
88  [0]=>
89  string(22) "This is a file in dir1"
90}
91
92array(1) {
93  [0]=>
94  string(22) "This is a file in dir1"
95}
96
97array(1) {
98  [0]=>
99  string(29) "This is a file in working dir"
100}
101
102array(1) {
103  [0]=>
104  string(28) "This is a file in script dir"
105}
106
107