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