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('', $linkname) );  // empty string as filename
23var_dump( link(' ', $linkname) );  // space as filename
24var_dump( link(false, $linkname) );  // boolean false as filename
25var_dump( link($filename, '') );  // '' as linkname
26var_dump( link($filename, false) );  // false as linkname
27
28echo "\n*** Testing is_link() for error conditions ***\n";
29
30//invalid arguments
31var_dump( is_link('') );  // empty string as linkname
32var_dump( is_link(' ') );  // space as linkname
33var_dump( is_link(false) );  // boolean false as linkname
34var_dump( is_link($filename) );  // file given to is_link
35
36echo "Done\n";
37?>
38--CLEAN--
39<?php
40unlink(__DIR__."/symlink_link_linkinfo_is_link_error2.tmp");
41?>
42--EXPECTF--
43*** Testing link() for error conditions ***
44
45Warning: link(): No such file or directory in %s on line %d
46bool(false)
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
60*** Testing is_link() for error conditions ***
61bool(false)
62bool(false)
63bool(false)
64bool(false)
65Done
66