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
8
9$thisTestDir = __DIR__ . '/' .basename(__FILE__, ".php") . ".dir";
10mkdir($thisTestDir);
11chdir($thisTestDir);
12
13$filename = basename(__FILE__, ".php") . ".tmp";
14$scriptLocFile = __DIR__."/".$filename;
15
16$newpath = "rubbish";
17set_include_path($newpath);
18runtest();
19$newpath = "";
20set_include_path($newpath);
21runtest();
22set_include_path("");
23runtest();
24set_include_path(";;  ; ;c:\\rubbish");
25runtest();
26
27chdir(__DIR__);
28
29
30function runtest() {
31   global $scriptLocFile, $filename;
32   file_put_contents($filename, "File written in working directory", FILE_USE_INCLUDE_PATH);
33   if(file_exists($scriptLocFile)) {
34      echo "Fail - this is PHP52 behaviour\n";
35      unlink($scriptLocFile);
36   }else {
37      $line = file_get_contents($filename);
38      echo "$line\n";
39      unlink($filename);
40   }
41}
42?>
43--CLEAN--
44<?php
45$thisTestDir = __DIR__ . '/' . basename(__FILE__, ".clean.php") . ".dir";
46$filename = basename(__FILE__, ".clean.php") . ".tmp";
47$scriptLocFile = __DIR__."/".$filename;
48@unlink($filename);
49@unlink($scriptLocFile);
50rmdir($thisTestDir);
51?>
52--EXPECT--
53File written in working directory
54File written in working directory
55File written in working directory
56File written in working directory
57