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