1--TEST--
2Test file_put_contents() function : variation - include path testing
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--FILE--
6<?php
7require_once('fopen_include_path.inc');
8
9$thisTestDir = basename(__FILE__, ".php") . ".dir";
10mkdir($thisTestDir);
11chdir($thisTestDir);
12
13$filename = basename(__FILE__, ".php") . ".tmp";
14
15$newpath = create_include_path();
16set_include_path($newpath);
17runtest();
18
19$newpath = generate_next_path();
20set_include_path($newpath);
21runtest();
22
23teardown_include_path();
24chdir("..");
25
26function runtest() {
27   global $filename;
28   //correct php53 behaviour is to ignore the FILE_USE_INCLUDE_PATH unless the file already exists
29   // in the include path. In this case it doesn't so the file should be written in the current dir.
30   file_put_contents($filename, "File in include path", FILE_USE_INCLUDE_PATH);
31   $line = file_get_contents($filename);
32   echo "$line\n";
33   unlink($filename);
34}
35
36?>
37--CLEAN--
38<?php
39$thisTestDir = basename(__FILE__, ".clean.php") . ".dir";
40$filename = basename(__FILE__, ".clean.php") . ".tmp";
41@unlink($filename);
42rmdir($thisTestDir);
43?>
44--EXPECT--
45File in include path
46File in include path
47