1--TEST-- 2Test fopen() function : variation: use include path create and read a file (relative) 3--CREDITS-- 4Dave Kelsey <d_kelsey@uk.ibm.com> 5--FILE-- 6<?php 7require_once('fopen_include_path.inc'); 8 9$thisTestDir = "fopenVariation16.dir"; 10mkdir($thisTestDir); 11chdir($thisTestDir); 12 13$newpath = create_include_path(); 14set_include_path($newpath); 15runtest(); 16 17$newpath = generate_next_path(); 18set_include_path($newpath); 19runtest(); 20 21teardown_include_path(); 22chdir(".."); 23rmdir($thisTestDir); 24 25function runtest() { 26 global $dir1; 27 28 $extraDir = "extraDir16"; 29 30 mkdir($dir1.'/'.$extraDir); 31 mkdir($extraDir); 32 33 $tmpfile = $extraDir.'/fopen_variation16.tmp'; 34 35 $h = fopen($tmpfile, "w+", true); 36 fwrite($h, "This is the test file"); 37 fclose($h); 38 39 $h = @fopen($dir1.'/'.$tmpfile, "r"); 40 if ($h === false) { 41 echo "Not created in dir1\n"; 42 } 43 else { 44 echo "created in dir1\n"; 45 fclose($h); 46 } 47 48 $h = fopen($tmpfile, "r", true); 49 if ($h === false) { 50 echo "could not find file for reading\n"; 51 } 52 else { 53 echo "found file - not in dir1\n"; 54 fclose($h); 55 } 56 57 unlink($tmpfile); 58 rmdir($dir1.'/'.$extraDir); 59 rmdir($extraDir); 60} 61?> 62--EXPECT-- 63Not created in dir1 64found file - not in dir1 65Not created in dir1 66found file - not in dir1 67