1--TEST--
2Test fileinode() function: usage variations - invalid filenames
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--FILE--
6<?php
7/*
8Prototype: int fileinode ( string $filename );
9Description: Returns the inode number of the file, or FALSE in case of an error.
10*/
11
12/* Testing fileinode() with invalid arguments -int, float, bool, NULL, resource */
13
14$file_path = dirname(__FILE__);
15$file_handle = fopen($file_path."/fileinode_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( fileinode($filename) );
36  clearstatcache();
37}
38fclose($file_handle);
39
40echo "\n*** Done ***";
41?>
42--CLEAN--
43<?php
44$file_path = dirname(__FILE__);
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 string, 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
71*** Done ***
72
73