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 11require_once('reading_include_path.inc'); 12 13//define the files to go into these directories, create one in dir2 14set_include_path($newIncludePath); 15test_gzfile(); 16restore_include_path(); 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===DONE=== 82--EXPECTF-- 83array(1) { 84 [0]=> 85 string(22) "This is a file in dir2" 86} 87 88array(1) { 89 [0]=> 90 string(22) "This is a file in dir1" 91} 92 93array(1) { 94 [0]=> 95 string(22) "This is a file in dir1" 96} 97 98array(1) { 99 [0]=> 100 string(29) "This is a file in working dir" 101} 102 103array(1) { 104 [0]=> 105 string(28) "This is a file in script dir" 106} 107 108===DONE=== 109 110