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();
31chdir("..");
32rmdir($thisTestDir);
33
34
35function runtest() {
36   global $filename;
37   //correct php53 behaviour is to ingnore the FILE_USE_INCLUDE_PATH unless the file alread exists
38   // in the include path. In this case it doesn't so the file should be written in the current dir.
39   file_put_contents($filename, "File in include path", FILE_USE_INCLUDE_PATH);
40   $line = file_get_contents($filename);
41   echo "$line\n";
42   unlink($filename);
43}
44
45?>
46===DONE===
47--EXPECT--
48File in include path
49File in include path
50===DONE===
51