1--TEST-- 2Test fileowner() function: usage variations - diff. path notations 3--CREDITS-- 4Dave Kelsey <d_kelsey@uk.ibm.com> 5--FILE-- 6<?php 7/* Prototype: int fileowner ( string $filename ) 8 * Description: Returns the user ID of the owner of the file, or 9 * FALSE in case of an error. 10 */ 11 12/* Passing file names with different notations, using slashes, wild-card chars */ 13 14$file_path = dirname(__FILE__); 15 16echo "*** Testing fileowner() with different notations of file names ***\n"; 17$dir_name = $file_path."/fileowner_variation3"; 18mkdir($dir_name); 19$file_handle = fopen($dir_name."/fileowner_variation3.tmp", "w"); 20fclose($file_handle); 21 22$files_arr = array( 23 "/fileowner_variation3/fileowner_variation3.tmp", 24 25 /* Testing a file trailing slash */ 26 "/fileowner_variation3/fileowner_variation3.tmp/", 27 28 /* Testing file with double slashes */ 29 "/fileowner_variation3//fileowner_variation3.tmp", 30 "//fileowner_variation3//fileowner_variation3.tmp", 31 "/fileowner_variation3/*.tmp", 32 "fileowner_variation3/fileowner*.tmp", 33 34 /* Testing Binary safe */ 35 "/fileowner_variation3/fileowner_variation3.tmp".chr(0), 36 "/fileowner_variation3/fileowner_variation3.tmp\0" 37); 38 39$count = 1; 40/* loop through to test each element in the above array */ 41foreach($files_arr as $file) { 42 echo "- Iteration $count -\n"; 43 var_dump( fileowner( $file_path."/".$file ) ); 44 clearstatcache(); 45 $count++; 46} 47 48echo "\n*** Done ***"; 49?> 50--CLEAN-- 51<?php 52$file_path = dirname(__FILE__); 53$dir_name = $file_path."/fileowner_variation3"; 54unlink($dir_name."/fileowner_variation3.tmp"); 55rmdir($dir_name); 56?> 57--EXPECTF-- 58*** Testing fileowner() with different notations of file names *** 59- Iteration 1 - 60int(%d) 61- Iteration 2 - 62 63Warning: fileowner(): stat failed for %s//fileowner_variation3/fileowner_variation3.tmp/ in %s on line %d 64bool(false) 65- Iteration 3 - 66int(%d) 67- Iteration 4 - 68int(%d) 69- Iteration 5 - 70 71Warning: fileowner(): stat failed for %s//fileowner_variation3/*.tmp in %s on line %d 72bool(false) 73- Iteration 6 - 74 75Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d 76bool(false) 77- Iteration 7 - 78bool(false) 79- Iteration 8 - 80bool(false) 81 82*** Done *** 83