Return to file_put_contents_variation5.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test file_put_contents() function : variation - include path testing 3: --CREDITS-- 4: Dave Kelsey <d_kelsey@uk.ibm.com> 5: --FILE-- 6: <?php 7: 8: 9: $thisTestDir = dirname(__FILE__) . '/' .basename(__FILE__, ".php") . ".directory"; 10: mkdir($thisTestDir); 11: chdir($thisTestDir); 12: 13: $filename = basename(__FILE__, ".php") . ".tmp"; 14: $scriptLocFile = dirname(__FILE__)."/".$filename; 15: 16: $newpath = "rubbish"; 17: set_include_path($newpath); 18: runtest(); 19: $newpath = ""; 20: set_include_path($newpath); 21: runtest(); 22: set_include_path(null); 23: runtest(); 24: set_include_path(";; ; ;c:\\rubbish"); 25: runtest(); 26: 27: chdir(dirname(__FILE__)); 28: rmdir($thisTestDir); 29: 30: 31: function 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-- 46: File written in working directory 47: File written in working directory 48: File written in working directory 49: File written in working directory 50: ===DONE=== 51: