1--TEST-- 2Test file_get_contents() function : variation - include path testing 3--CREDITS-- 4Dave Kelsey <d_kelsey@uk.ibm.com> 5--FILE-- 6<?php 7/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]]) 8 * Description: Read the entire file into a string 9 * Source code: ext/standard/file.c 10 * Alias to functions: 11 */ 12 13echo "*** Testing file_get_contents() : variation ***\n"; 14 15require_once('fopen_include_path.inc'); 16 17// this doesn't create the include dirs in this directory 18// we change to this to ensure we are not part of the 19// include paths. 20$thisTestDir = "fileGetContentsVar1.dir"; 21mkdir($thisTestDir); 22chdir($thisTestDir); 23 24$filename = "afile.txt"; 25$secondFile = $dir2."/".$filename; 26 27$newpath = create_include_path(); 28set_include_path($newpath); 29runtest(); 30teardown_include_path(); 31chdir(".."); 32rmdir($thisTestDir); 33 34 35function runtest() { 36 global $secondFile, $filename; 37 $h = fopen($secondFile, "w"); 38 fwrite($h, "File in include path"); 39 fclose($h); 40 $line = file_get_contents($filename, true); 41 echo "$line\n"; 42 unlink($secondFile); 43} 44 45?> 46===DONE=== 47--EXPECT-- 48*** Testing file_get_contents() : variation *** 49File in include path 50===DONE=== 51