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 = __DIR__;
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--CLEAN--
33<?php
34$file_path = __DIR__;
35$file_name = $file_path."/fileowner_basic.tmp";
36$dir_name = $file_path."/fileowner_basic";
37unlink($file_name);
38rmdir($dir_name);
39?>
40--EXPECTF--
41*** Testing fileowner(): basic functionality ***
42-- Testing with the file or directory created by owner --
43int(%d)
44int(%d)
45int(%d)
46int(%d)
47int(%d)
48*** Done ***
49