1--TEST--
2Test readfile() function: usage variation - include path
3--FILE--
4<?php
5/* test readfile() by providing an include path, second argument */
6
7// include file.inc
8require("file.inc");
9
10$file_path = __DIR__;
11$dirname = "$file_path/readfile_variation3";
12
13echo "*** Testing readfile(): checking second argument, include path ***\n";
14// temp dir created
15mkdir($dirname);
16// temp file name used here
17$filename = "$dirname/readfile_variation3.tmp";
18// create file
19$fp = fopen($filename, "w");
20fill_file($fp, "text_with_new_line", 50);
21fclose($fp);
22
23// including $dirname in 'include_path'
24ini_set('include_path',$dirname);
25// 'include_path' set to true
26$count = readfile("readfile_variation3.tmp", true);
27echo "\n";
28var_dump($count);
29// use the context argument with include path
30echo "*** Testing readfile(): checking second argument, include path with context specified ***\n";
31$context = stream_context_create();
32$count = readfile("readfile_variation3.tmp", true, $context);
33echo "\n";
34var_dump($count);
35
36echo "Done\n";
37?>
38--CLEAN--
39<?php
40unlink(__DIR__."/readfile_variation3/readfile_variation3.tmp");
41rmdir(__DIR__."/readfile_variation3");
42?>
43--EXPECT--
44*** Testing readfile(): checking second argument, include path ***
45line
46line of text
47line
48line of text
49line
50line of t
51int(50)
52*** Testing readfile(): checking second argument, include path with context specified ***
53line
54line of text
55line
56line of text
57line
58line of t
59int(50)
60Done
61