1--TEST--
2Test fopen() function : variation: use include path create a file (absolute)
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
13require_once('fopen_include_path.inc');
14
15echo "*** Testing fopen() : variation ***\n";
16$newpath = create_include_path();
17set_include_path($newpath);
18runtest();
19$newpath = generate_next_path();
20set_include_path($newpath);
21runtest();
22
23teardown_include_path();
24
25
26function runtest() {
27    $tempDir = 'fopen_variation13.dir.tmp';
28	$tmpfile = 'fopen_variation13.tmp';
29	$absFile = getcwd().'/'.$tempDir.'/'.$tmpfile;
30
31	mkdir($tempDir);
32	$h = fopen($absFile, "w", true);
33	fwrite($h, "This is the test file");
34	fclose($h);
35
36
37	$h = fopen($absFile, "r");
38	if ($h === false) {
39	   echo "Not created absolute location\n";
40	}
41	else {
42	   echo "Created in correct location\n";
43	   fclose($h);
44	}
45    unlink($absFile);
46    rmdir($tempDir);
47
48}
49?>
50===DONE===
51--EXPECT--
52*** Testing fopen() : variation ***
53Created in correct location
54Created in correct location
55===DONE===
56