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