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
7/* Prototype  : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
8 * Description: Open a file or a URL and return a file pointer
9 * Source code: ext/standard/file.c
10 * Alias to functions:
11 */
12
13set_include_path("rubbish");
14testme();
15restore_include_path();
16
17
18function testme() {
19	$tmpfile = basename(__FILE__, ".php") . ".tmp";
20	$h = fopen($tmpfile, "w", true);
21	fwrite($h, "This is the test file");
22	fclose($h);
23
24
25	$h = @fopen($tmpfile, "r");
26	if ($h === false) {
27	   echo "Not created in working dir\n";
28	}
29	else {
30	   echo "created in working dir\n";
31	   fclose($h);
32	   unlink($tmpfile);
33	}
34
35
36	$scriptDirFile = dirname(__FILE__).'/'.$tmpfile;
37	$h = @fopen($scriptDirFile, "r");
38	if ($h === false) {
39	   echo "Not created in script dir\n";
40	}
41	else {
42	   echo "created in script dir\n";
43	   fclose($h);
44	   unlink($scriptDirFile);
45	}
46}
47?>
48===DONE===
49--EXPECT--
50created in working dir
51Not created in script dir
52===DONE===
53