1--TEST--
2Test symlink(), linkinfo(), link() and is_link() functions : error conditions - symlink & linkinfo
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'SUN') {
6  die('skip Not valid for Sun Solaris');
7}
8?>
9--FILE--
10<?php
11// create temp $filename and create link $linkname to it
12$filename = __DIR__."/symlink_link_linkinfo_is_link_error1.tmp";
13$fp = fopen($filename, "w");  // create temp file
14fclose($fp);
15
16// linkname used to create soft/hard link
17$linkname = __DIR__."/symlink_link_linkinfo_is_link_link_error1.tmp";
18
19echo "*** Testing symlink() for error conditions ***\n";
20
21//invalid arguments
22var_dump( symlink(NULL, $linkname) );  // NULL as filename
23var_dump( symlink('', $linkname) );  // empty string as filename
24var_dump( symlink(false, $linkname) );  // boolean false as filename
25var_dump( symlink($filename, NULL) );  // NULL as linkname
26var_dump( symlink($filename, '') );  // '' as linkname
27var_dump( symlink($filename, false) );  // false as linkname
28
29echo "\n*** Testing linkinfo() for error conditions ***\n";
30
31//invalid arguments
32var_dump( linkinfo(NULL) );  // NULL as linkname
33var_dump( linkinfo('') );  // empty string as linkname
34var_dump( linkinfo(false) );  // boolean false as linkname
35
36echo "Done\n";
37?>
38--CLEAN--
39<?php
40unlink(__DIR__."/symlink_link_linkinfo_is_link_error1.tmp");
41@unlink(__DIR__."/symlink_link_linkinfo_is_link_link_error1.tmp");
42?>
43--EXPECTF--
44*** Testing symlink() for error conditions ***
45
46Warning: symlink(): %s in %s on line %d
47bool(false)
48
49Warning: symlink(): %s in %s on line %d
50bool(false)
51
52Warning: symlink(): %s in %s on line %d
53bool(false)
54
55Warning: symlink(): %s in %s on line %d
56bool(false)
57
58Warning: symlink(): %s in %s on line %d
59bool(false)
60
61Warning: symlink(): %s in %s on line %d
62bool(false)
63
64*** Testing linkinfo() for error conditions ***
65
66Warning: linkinfo(): %s in %s on line %d
67int(-1)
68
69Warning: linkinfo(): %s in %s on line %d
70int(-1)
71
72Warning: linkinfo(): %s in %s on line %d
73int(-1)
74Done
75