1--TEST--
2Test fileinode() function: usage variations - invalid filenames
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--CONFLICTS--
6obscure_filename
7--FILE--
8<?php
9/*
10Prototype: int fileinode ( string $filename );
11Description: Returns the inode number of the file, or FALSE in case of an error.
12*/
13
14/* Testing fileinode() with invalid arguments -int, float, bool, NULL, resource */
15
16$file_path = __DIR__;
17$file_handle = fopen($file_path."/fileinode_variation2.tmp", "w");
18
19echo "*** Testing Invalid file types ***\n";
20$filenames = array(
21  /* Invalid filenames */
22  -2.34555,
23  " ",
24  "",
25  TRUE,
26  FALSE,
27  NULL,
28  $file_handle,
29
30  /* scalars */
31  1234,
32  0
33);
34
35/* loop through to test each element the above array */
36foreach( $filenames as $filename ) {
37  var_dump( fileinode($filename) );
38  clearstatcache();
39}
40fclose($file_handle);
41?>
42--CLEAN--
43<?php
44$file_path = __DIR__;
45unlink($file_path."/fileinode_variation2.tmp");
46?>
47--EXPECTF--
48*** Testing Invalid file types ***
49
50Warning: fileinode(): stat failed for -2.34555 in %s on line %d
51bool(false)
52
53Warning: fileinode(): stat failed for   in %s on line %d
54bool(false)
55bool(false)
56
57Warning: fileinode(): stat failed for 1 in %s on line %d
58bool(false)
59bool(false)
60bool(false)
61
62Warning: fileinode() expects parameter 1 to be a valid path, resource given in %s on line %d
63NULL
64
65Warning: fileinode(): stat failed for 1234 in %s on line %d
66bool(false)
67
68Warning: fileinode(): stat failed for 0 in %s on line %d
69bool(false)
70