1--TEST--
2Test file_get_contents() and file_put_contents() functions : usage variations - use_include_path
3
4--FILE--
5<?php
6/* Prototype: string file_get_contents( string $filename[, bool $use_include_path[,
7 *                                      resource $context[, int $offset[, int $maxlen]]]] )
8 * Description: Reads entire file into a string
9 */
10
11/* Prototype: int file_put_contents( string $filename, mixed $data[,int $flags[, resource $context]] )
12 * Description: Write a string to a file
13 */
14
15/* Testing variation using use_include_path argument */
16$file_path = dirname(__FILE__);
17include($file_path."/file.inc");
18
19echo "*** Testing with variation in use_include_path argument ***\n";
20$dir = "file_get_contents_variation2";
21mkdir($file_path."/".$dir);
22$filename = $file_path."/".$dir."/"."file_get_contents_variation2.tmp";
23
24ini_set( 'include_path',$file_path."/".$dir );
25
26$data_array = array( 1, "  Data1 in an array", 2, "  Data2 in an array" );
27fill_buffer( $buffer, "text", 100);
28file_put_contents( $filename, $buffer );
29fill_buffer( $buffer, "numeric", 100);
30file_put_contents( $filename, $buffer, FILE_APPEND, NULL );
31file_put_contents( $filename, $data_array, FILE_APPEND, NULL );
32var_dump( file_get_contents($filename, 0) );
33var_dump( file_get_contents($filename, 1) );
34var_dump( file_get_contents($filename, 0, NULL, 5) );
35var_dump( file_get_contents($filename, 1, NULL, 5) );
36var_dump( file_get_contents($filename, 0, NULL, 5, 20) );
37var_dump( file_get_contents($filename, 1, NULL, 5, 20) );
38
39echo "--- Done ---";
40?>
41--CLEAN--
42<?php
43//Deleting the temporary files and directory used in the testcase
44
45$file_path = dirname(__FILE__);
46unlink($file_path."/file_get_contents_variation2/file_get_contents_variation2.tmp");
47rmdir($file_path."/file_get_contents_variation2");
48?>
49--EXPECTF--
50*** Testing with variation in use_include_path argument ***
51string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221  Data1 in an array2  Data2 in an array"
52string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221  Data1 in an array2  Data2 in an array"
53string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221  Data1 in an array2  Data2 in an array"
54string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221  Data1 in an array2  Data2 in an array"
55string(20) "text text text text "
56string(20) "text text text text "
57--- Done ---
58