1--TEST--
2Test fileowner() function: basic functionality
3--FILE--
4<?php
5/* Prototype: int fileowner ( string $filename )
6 * Description: Returns the user ID of the owner of the file, or
7 *              FALSE in case of an error.
8 */
9
10echo "*** Testing fileowner(): basic functionality ***\n";
11
12echo "-- Testing with the file or directory created by owner --\n";
13var_dump( fileowner(__FILE__) );
14var_dump( fileowner(".") );
15var_dump( fileowner("./..") );
16
17/* Newly created files and dirs */
18$file_path = dirname(__FILE__);
19$file_name = $file_path."/fileowner_basic.tmp";
20$file_handle = fopen($file_name, "w");
21$string = "Hello, world\n1234\n123Hello";
22fwrite($file_handle, $string);
23var_dump( fileowner($file_name) );
24fclose($file_handle);
25
26$dir_name = $file_path."/fileowner_basic";
27mkdir($dir_name);
28var_dump( fileowner($dir_name) );
29
30echo "*** Done ***\n";
31?>
32
33--CLEAN--
34<?php
35$file_path = dirname(__FILE__);
36$file_name = $file_path."/fileowner_basic.tmp";
37$dir_name = $file_path."/fileowner_basic";
38unlink($file_name);
39rmdir($dir_name);
40?>
41
42--EXPECTF--
43*** Testing fileowner(): basic functionality ***
44-- Testing with the file or directory created by owner --
45int(%d)
46int(%d)
47int(%d)
48int(%d)
49int(%d)
50*** Done ***
51
52