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 13echo "*** Testing file_put_contents() : variation ***\n"; 14 15require_once('fopen_include_path.inc'); 16 17$thisTestDir = basename(__FILE__, ".php") . ".dir"; 18mkdir($thisTestDir); 19chdir($thisTestDir); 20 21$filename = basename(__FILE__, ".php") . ".tmp"; 22 23$newpath = create_include_path(); 24set_include_path($newpath); 25runtest(); 26 27$newpath = generate_next_path(); 28set_include_path($newpath); 29runtest(); 30 31teardown_include_path(); 32chdir(".."); 33rmdir($thisTestDir); 34 35 36function runtest() { 37 global $filename; 38 39 //correct php53 behaviour is to ignore the FILE_USE_INCLUDE_PATH unless the file already exists 40 // in the include path. In this case it doesn't so the file should be written in the current dir. 41 42 file_put_contents($filename, "File in include path", FILE_USE_INCLUDE_PATH); 43 file_put_contents($filename, ". This was appended", FILE_USE_INCLUDE_PATH | FILE_APPEND); 44 $line = file_get_contents($filename); 45 echo "$line\n"; 46 unlink($filename); 47} 48 49?> 50===DONE=== 51--EXPECT-- 52*** Testing file_put_contents() : variation *** 53File in include path. This was appended 54File in include path. This was appended 55===DONE=== 56