1--TEST--
2Test fileowner() function: usage variations - invalid filenames
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/* Testing fileowner() with invalid arguments -int, float, bool, NULL, resource */
13
14$file_path = dirname(__FILE__);
15$file_handle = fopen($file_path."/fileowner_variation2.tmp", "w");
16
17echo "*** Testing Invalid file types ***\n";
18$filenames = array(
19  /* Invalid filenames */
20  -2.34555,
21  " ",
22  "",
23  TRUE,
24  FALSE,
25  NULL,
26  $file_handle,
27
28  /* scalars */
29  1234,
30  0
31);
32
33/* loop through to test each element the above array */
34foreach( $filenames as $filename ) {
35  var_dump( fileowner($filename) );
36  clearstatcache();
37}
38fclose($file_handle);
39
40echo "\n*** Done ***";
41?>
42--CLEAN--
43<?php
44$file_path = dirname(__FILE__);
45unlink($file_path."/fileowner_variation2.tmp");
46?>
47--EXPECTF--
48*** Testing Invalid file types ***
49
50Warning: fileowner(): stat failed for -2.34555 in %s on line %d
51bool(false)
52
53Warning: fileowner(): stat failed for   in %s on line %d
54bool(false)
55bool(false)
56
57Warning: fileowner(): stat failed for 1 in %s on line %d
58bool(false)
59bool(false)
60bool(false)
61
62Warning: fileowner() expects parameter 1 to be a valid path, resource given in %s on line %d
63NULL
64
65Warning: fileowner(): stat failed for 1234 in %s on line %d
66bool(false)
67
68Warning: fileowner(): stat failed for 0 in %s on line %d
69bool(false)
70
71*** Done ***
72