1--TEST--
2Test symlink(), linkinfo(), link() and is_link() functions : error conditions - link & is_link
3--SKIPIF--
4<?php
5if (PHP_OS_FAMILY === 'Windows' && PHP_ZTS) {
6    die('xfail different handling of space as filename with ZTS/NTS on Windows');
7}
8?>
9--FILE--
10<?php
11// create temp $filename and create link $linkname to it
12$filename = __DIR__."/symlink_link_linkinfo_is_link_error2.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_error2.tmp";
18
19echo "*** Testing link() for error conditions ***\n";
20
21//invalid arguments
22var_dump( link(NULL, $linkname) );  // NULL as filename
23var_dump( link('', $linkname) );  // empty string as filename
24var_dump( link(' ', $linkname) );  // space as filename
25var_dump( link(false, $linkname) );  // boolean false as filename
26var_dump( link($filename, NULL) );  // NULL as linkname
27var_dump( link($filename, '') );  // '' as linkname
28var_dump( link($filename, false) );  // false as linkname
29
30echo "\n*** Testing is_link() for error conditions ***\n";
31
32//invalid arguments
33var_dump( is_link(NULL) );  // NULL as linkname
34var_dump( is_link('') );  // empty string as linkname
35var_dump( is_link(' ') );  // space as linkname
36var_dump( is_link(false) );  // boolean false as linkname
37var_dump( is_link($filename) );  // file given to is_link
38
39echo "Done\n";
40?>
41--CLEAN--
42<?php
43unlink(__DIR__."/symlink_link_linkinfo_is_link_error2.tmp");
44?>
45--EXPECTF--
46*** Testing link() for error conditions ***
47
48Warning: link(): No such file or directory in %s on line %d
49bool(false)
50
51Warning: link(): No such file or directory in %s on line %d
52bool(false)
53
54Warning: link(): No such file or directory in %s on line %d
55bool(false)
56
57Warning: link(): No such file or directory in %s on line %d
58bool(false)
59
60Warning: link(): No such file or directory in %s on line %d
61bool(false)
62
63Warning: link(): No such file or directory in %s on line %d
64bool(false)
65
66Warning: link(): No such file or directory in %s on line %d
67bool(false)
68
69*** Testing is_link() for error conditions ***
70bool(false)
71bool(false)
72bool(false)
73bool(false)
74bool(false)
75Done
76