1--TEST-- 2Test fopen() function : variation: use include path (path is bad) create a file (relative) 3--CREDITS-- 4Dave Kelsey <d_kelsey@uk.ibm.com> 5--FILE-- 6<?php 7set_include_path("rubbish"); 8testme(); 9 10 11function testme() { 12 $tmpfile = basename(__FILE__, ".php") . ".tmp"; 13 $h = fopen($tmpfile, "w", true); 14 fwrite($h, "This is the test file"); 15 fclose($h); 16 17 18 $h = @fopen($tmpfile, "r"); 19 if ($h === false) { 20 echo "Not created in working dir\n"; 21 } 22 else { 23 echo "created in working dir\n"; 24 fclose($h); 25 unlink($tmpfile); 26 } 27 28 29 $scriptDirFile = __DIR__.'/'.$tmpfile; 30 $h = @fopen($scriptDirFile, "r"); 31 if ($h === false) { 32 echo "Not created in script dir\n"; 33 } 34 else { 35 echo "created in script dir\n"; 36 fclose($h); 37 unlink($scriptDirFile); 38 } 39} 40?> 41--EXPECT-- 42created in working dir 43Not created in script dir 44