1--TEST--
2Test readlink() function: usage variations - invalid filenames
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--SKIPIF--
6<?php
7if (substr(PHP_OS, 0, 3) == 'WIN') {
8    die('skip no links on Windows');
9}
10?>
11--FILE--
12<?php
13/* Prototype: string readlink ( string $path );
14   Description: Returns the target of a symbolic link */
15
16/* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */
17
18$file_path = dirname(__FILE__);
19$file_handle = fopen($file_path."/readlink_variation2.tmp", "w");
20
21echo "*** Testing Invalid file types ***\n";
22$filenames = array(
23  /* Invalid filenames */
24  -2.34555,
25  "",
26  TRUE,
27  FALSE,
28  NULL,
29  $file_handle,
30
31  /* scalars */
32  1234,
33  0
34);
35
36/* loop through to test each element the above array */
37foreach( $filenames as $filename ) {
38  var_dump( readlink($filename) );
39  clearstatcache();
40}
41fclose($file_handle);
42
43echo "\n*** Done ***";
44?>
45--CLEAN--
46<?php
47$file_path = dirname(__FILE__);
48unlink($file_path."/readlink_variation2.tmp");
49?>
50--EXPECTF--
51*** Testing Invalid file types ***
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(): %s in %s on line %d
63bool(false)
64
65Warning: readlink(): %s in %s on line %d
66bool(false)
67
68Warning: readlink() expects parameter 1 to be string, resource given in %s on line %d
69NULL
70
71Warning: readlink(): %s in %s on line %d
72bool(false)
73
74Warning: readlink(): %s in %s on line %d
75bool(false)
76
77*** Done ***
78
79