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