1--TEST--
2Test readlink() and realpath() functions: usage variation - invalid args
3--FILE--
4<?php
5/* Prototype: string readlink ( string $path );
6   Description: Returns the target of a symbolic link
7
8   Prototype: string realpath ( string $path );
9   Description: Returns canonicalized absolute pathname
10*/
11
12echo "*** Testing readlink() and realpath() : usage variations ***\n";
13
14echo "\n*** Testing readlink() and realpath() with linkname as empty string, NULL and single space ***\n";
15$link_string = array (
16  /* linkname as spaces */
17  " ",
18  ' ',
19
20  /* empty linkname */
21  "",
22  '',
23  NULL,
24  null
25 );
26for($loop_counter = 0; $loop_counter < count($link_string); $loop_counter++) {
27  echo "-- Iteration";
28  echo $loop_counter + 1;
29  echo " --\n";
30
31  var_dump( readlink($link_string[$loop_counter]) );
32  var_dump( realpath($link_string[$loop_counter]) );
33}
34
35echo "Done\n";
36?>
37--EXPECTF--
38*** Testing readlink() and realpath() : usage variations ***
39
40*** Testing readlink() and realpath() with linkname as empty string, NULL and single space ***
41-- Iteration1 --
42
43Warning: readlink(): %s in %s on line %d
44bool(false)
45%s
46-- Iteration2 --
47
48Warning: readlink(): %s in %s on line %d
49bool(false)
50%s
51-- Iteration3 --
52
53Warning: readlink(): %s in %s on line %d
54bool(false)
55string(%d) "%s"
56-- Iteration4 --
57
58Warning: readlink(): %s in %s on line %d
59bool(false)
60string(%d) "%s"
61-- Iteration5 --
62
63Warning: readlink(): %s in %s on line %d
64bool(false)
65string(%d) "%s"
66-- Iteration6 --
67
68Warning: readlink(): %s in %s on line %d
69bool(false)
70string(%d) "%s"
71Done
72