1--TEST--
2Test file_put_contents() function : variation - include path testing
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--FILE--
6<?php
7/* Prototype  : int file_put_contents(string file, mixed data [, int flags [, resource context]])
8 * Description: Write/Create a file with contents data and return the number of bytes written
9 * Source code: ext/standard/file.c
10 * Alias to functions:
11 */
12
13
14require_once('fopen_include_path.inc');
15
16$thisTestDir = basename(__FILE__, ".php") . ".dir";
17mkdir($thisTestDir);
18chdir($thisTestDir);
19
20$filename = basename(__FILE__, ".php") . ".tmp";
21
22$newpath = create_include_path();
23set_include_path($newpath);
24runtest();
25
26$newpath = generate_next_path();
27set_include_path($newpath);
28runtest();
29
30teardown_include_path();
31restore_include_path();
32chdir("..");
33rmdir($thisTestDir);
34
35
36function runtest() {
37   global $filename;
38   //correct php53 behaviour is to ingnore the FILE_USE_INCLUDE_PATH unless the file alread exists
39   // in the include path. In this case it doesn't so the file should be written in the current dir.
40   file_put_contents($filename, (binary) "File in include path", FILE_USE_INCLUDE_PATH);
41   $line = file_get_contents($filename);
42   echo "$line\n";
43   unlink($filename);
44}
45
46?>
47===DONE===
48--EXPECT--
49File in include path
50File in include path
51===DONE===
52