1--TEST--
2Test fopen() function : variation: use include path and stream context relative/absolute file
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
13echo "*** Testing fopen() : variation ***\n";
14$absfile = __FILE__.'.tmp';
15$relfile = "fopen_variation6.tmp";
16
17$h = fopen($absfile, "w");
18fwrite($h, "This is an absolute file");
19fclose($h);
20
21$h = fopen($relfile, "w");
22fwrite($h, "This is a relative file");
23fclose($h);
24
25$ctx = stream_context_create();
26$h = fopen($absfile, "r", true, $ctx);
27fpassthru($h);
28fclose($h);
29echo "\n";
30
31$h = fopen($relfile, "r", true, $ctx);
32fpassthru($h);
33fclose($h);
34echo "\n";
35
36unlink($absfile);
37unlink($relfile);
38?>
39===DONE===
40--EXPECTF--
41*** Testing fopen() : variation ***
42This is an absolute file
43This is a relative file
44===DONE===
45