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