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();
24restore_include_path();
25
26
27function runtest() {
28    $tempDir = 'fopen_variation13.dir.tmp';
29	$tmpfile = 'fopen_variation13.tmp';
30	$absFile = getcwd().'/'.$tempDir.'/'.$tmpfile;
31
32	mkdir($tempDir);
33	$h = fopen($absFile, "w", true);
34	fwrite($h, "This is the test file");
35	fclose($h);
36
37
38	$h = fopen($absFile, "r");
39	if ($h === false) {
40	   echo "Not created absolute location\n";
41	}
42	else {
43	   echo "Created in correct location\n";
44	   fclose($h);
45	}
46    unlink($absFile);
47    rmdir($tempDir);
48
49}
50?>
51===DONE===
52--EXPECT--
53*** Testing fopen() : variation ***
54Created in correct location
55Created in correct location
56===DONE===
57