1--TEST-- 2stream_get_meta_data() with a relative file path 3--FILE-- 4<?php 5 6echo "Create a file:\n"; 7$filename = __FILE__ . '.tmp'; 8$fp = fopen('File://' . $filename, 'w+'); 9 10var_dump(stream_get_meta_data($fp)); 11 12fclose($fp); 13 14echo "\nChange to file's directory and open with a relative path:\n"; 15 16$dirname = dirname($filename); 17chdir($dirname); 18$relative_filename = basename($filename); 19 20$fp = fopen($relative_filename, 'r'); 21var_dump(stream_get_meta_data($fp)); 22 23fclose($fp); 24 25unlink($filename); 26 27?> 28--EXPECTF-- 29Create a file: 30array(9) { 31 ["wrapper_type"]=> 32 string(9) "plainfile" 33 ["stream_type"]=> 34 string(5) "STDIO" 35 ["mode"]=> 36 string(2) "w+" 37 ["unread_bytes"]=> 38 int(0) 39 ["seekable"]=> 40 bool(true) 41 ["uri"]=> 42 string(%i) "File://%sstream_get_meta_data_file_variation4.php.tmp" 43 ["timed_out"]=> 44 bool(false) 45 ["blocked"]=> 46 bool(true) 47 ["eof"]=> 48 bool(false) 49} 50 51Change to file's directory and open with a relative path: 52array(9) { 53 ["wrapper_type"]=> 54 string(9) "plainfile" 55 ["stream_type"]=> 56 string(5) "STDIO" 57 ["mode"]=> 58 string(1) "r" 59 ["unread_bytes"]=> 60 int(0) 61 ["seekable"]=> 62 bool(true) 63 ["uri"]=> 64 string(%i) "stream_get_meta_data_file_variation4.php.tmp" 65 ["timed_out"]=> 66 bool(false) 67 ["blocked"]=> 68 bool(true) 69 ["eof"]=> 70 bool(false) 71} 72