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(); 32restore_include_path(); 33chdir(".."); 34rmdir($thisTestDir); 35 36function runtest() { 37 $tmpfile = 'gzopen_variation5.tmp'; 38 $h = gzopen($tmpfile, "w", true); 39 fwrite($h, "This is the test file"); 40 fclose($h); 41 42 43 $h = @gzopen($tmpfile, "r"); 44 if ($h === false) { 45 echo "Not created in working dir\n"; 46 } 47 else { 48 echo "created in working dir\n"; 49 gzclose($h); 50 unlink($tmpfile); 51 } 52 53 $h = @gzopen('dir1/'.$tmpfile, "r"); 54 if ($h === false) { 55 echo "Not created in dir1\n"; 56 } 57 else { 58 echo "created in dir1\n"; 59 gzclose($h); 60 unlink('dir1/'.$tmpfile); 61 } 62} 63?> 64===DONE=== 65--EXPECT-- 66*** Testing gzopen() : variation *** 67created in working dir 68Not created in dir1 69created in working dir 70Not created in dir1 71===DONE=== 72