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(".."); 27 28 29function runtest() { 30 global $filename; 31 32 //correct php53 behaviour is to ignore the FILE_USE_INCLUDE_PATH unless the file already exists 33 // in the include path. In this case it doesn't so the file should be written in the current dir. 34 35 file_put_contents($filename, "File in include path", FILE_USE_INCLUDE_PATH); 36 file_put_contents($filename, ". This was appended", FILE_USE_INCLUDE_PATH | FILE_APPEND); 37 $line = file_get_contents($filename); 38 echo "$line\n"; 39 unlink($filename); 40} 41 42?> 43--CLEAN-- 44<?php 45$thisTestDir = basename(__FILE__, ".clean.php") . ".dir"; 46$filename = basename(__FILE__, ".clean.php") . ".tmp"; 47@unlink($filename); 48rmdir($thisTestDir); 49?> 50--EXPECT-- 51*** Testing file_put_contents() : variation *** 52File in include path. This was appended 53File in include path. This was appended 54