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 15 16require_once('fopen_include_path.inc'); 17 18// this doesn't create the include dirs in this directory 19// we change to this to ensure we are not part of the 20// include paths. 21$thisTestDir = "FileGetContentsVar2.dir"; 22mkdir($thisTestDir); 23chdir($thisTestDir); 24 25$filename = 'FileGetContentsVar2.tmp'; 26$scriptLocFile = __DIR__."/".$filename; 27 28$newpath = create_include_path(); 29set_include_path($newpath); 30runtest(); 31teardown_include_path(); 32chdir(".."); 33rmdir($thisTestDir); 34 35 36function runtest() { 37 global $scriptLocFile, $filename; 38 $h = fopen($scriptLocFile, "w"); 39 fwrite($h, "File in script location"); 40 fclose($h); 41 $line = file_get_contents($filename, true); 42 echo "$line\n"; 43 unlink($scriptLocFile); 44} 45 46?> 47===DONE=== 48--EXPECT-- 49*** Testing file_get_contents() : variation *** 50File in script location 51===DONE=== 52