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
11/* Prototype  : resource gzopen(string filename, string mode [, int use_include_path])
12 * Description: Open a .gz-file and return a .gz-file pointer
13 * Source code: ext/zlib/zlib.c
14 * Alias to functions:
15 */
16
17require_once('gzopen_include_path.inc');
18
19echo "*** Testing gzopen() : variation ***\n";
20$thisTestDir = "gzopenVariation5.dir";
21mkdir($thisTestDir);
22chdir($thisTestDir);
23
24$newpath = relative_include_path();
25set_include_path($newpath);
26runtest();
27$newpath = generate_next_rel_path();
28set_include_path($newpath);
29runtest();
30
31teardown_relative_path();
32chdir("..");
33rmdir($thisTestDir);
34
35function runtest() {
36	$tmpfile = 'gzopen_variation5.tmp';
37	$h = gzopen($tmpfile, "w", true);
38	fwrite($h, "This is the test file");
39	fclose($h);
40
41
42	$h = @gzopen($tmpfile, "r");
43	if ($h === false) {
44	   echo "Not created in working dir\n";
45	}
46	else {
47	   echo "created in working dir\n";
48	   gzclose($h);
49	   unlink($tmpfile);
50	}
51
52	$h = @gzopen('dir1/'.$tmpfile, "r");
53	if ($h === false) {
54	   echo "Not created in dir1\n";
55	}
56	else {
57	   echo "created in dir1\n";
58	   gzclose($h);
59	   unlink('dir1/'.$tmpfile);
60	}
61}
62?>
63===DONE===
64--EXPECT--
65*** Testing gzopen() : variation ***
66created in working dir
67Not created in dir1
68created in working dir
69Not created in dir1
70===DONE===
71