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();
15
16
17function testme() {
18	$tmpfile = basename(__FILE__, ".php") . ".tmp";
19	$h = fopen($tmpfile, "w", true);
20	fwrite($h, "This is the test file");
21	fclose($h);
22
23
24	$h = @fopen($tmpfile, "r");
25	if ($h === false) {
26	   echo "Not created in working dir\n";
27	}
28	else {
29	   echo "created in working dir\n";
30	   fclose($h);
31	   unlink($tmpfile);
32	}
33
34
35	$scriptDirFile = __DIR__.'/'.$tmpfile;
36	$h = @fopen($scriptDirFile, "r");
37	if ($h === false) {
38	   echo "Not created in script dir\n";
39	}
40	else {
41	   echo "created in script dir\n";
42	   fclose($h);
43	   unlink($scriptDirFile);
44	}
45}
46?>
47===DONE===
48--EXPECT--
49created in working dir
50Not created in script dir
51===DONE===
52