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