1--TEST--
2Test gzopen() function : variation: use include path and stream context create a file, relative path
3--SKIPIF--
4<?php
5if (!extension_loaded("zlib")) {
6    print "skip - ZLIB extension not loaded";
7}
8?>
9--FILE--
10<?php
11require_once('gzopen_include_path.inc');
12
13echo "*** Testing gzopen() : variation ***\n";
14$thisTestDir = "gzopenVariation5.dir";
15mkdir($thisTestDir);
16chdir($thisTestDir);
17
18$newpath = relative_include_path();
19set_include_path($newpath);
20runtest();
21$newpath = generate_next_rel_path();
22set_include_path($newpath);
23runtest();
24
25teardown_relative_path();
26chdir("..");
27rmdir($thisTestDir);
28
29function runtest() {
30    $tmpfile = 'gzopen_variation5.tmp';
31    $h = gzopen($tmpfile, "w", true);
32    fwrite($h, "This is the test file");
33    fclose($h);
34
35
36    $h = @gzopen($tmpfile, "r");
37    if ($h === false) {
38       echo "Not created in working dir\n";
39    }
40    else {
41       echo "created in working dir\n";
42       gzclose($h);
43       unlink($tmpfile);
44    }
45
46    $h = @gzopen('dir1/'.$tmpfile, "r");
47    if ($h === false) {
48       echo "Not created in dir1\n";
49    }
50    else {
51       echo "created in dir1\n";
52       gzclose($h);
53       unlink('dir1/'.$tmpfile);
54    }
55}
56?>
57--EXPECT--
58*** Testing gzopen() : variation ***
59created in working dir
60Not created in dir1
61created in working dir
62Not created in dir1
63