1--TEST--
2Test symlink(), linkinfo(), link() and is_link() functions : usage variations - hardlink to non-existent file
3--FILE--
4<?php
5/* Prototype: bool symlink ( string $target, string $link );
6   Description: creates a symbolic link to the existing target with the specified name link
7
8   Prototype: bool is_link ( string $filename );
9   Description: Tells whether the given file is a symbolic link.
10
11   Prototype: bool link ( string $target, string $link );
12   Description: Create a hard link
13
14   Prototype: int linkinfo ( string $path );
15   Description: Gets information about a link
16*/
17
18/* Variation 2 : Create hard link to non-existent file */
19
20$file_path = __DIR__;
21// non-existing filename
22$non_existent_file = "$file_path/non_existent_file_variation2.tmp";
23// non-existing linkname
24$non_existent_linkname = "$file_path/non_existent_linkname_variation2.tmp";
25
26echo "*** Creating a hard link to a non-existent file ***\n";
27// creating hard link to non_existent file
28var_dump( link($non_existent_file, $non_existent_linkname) ); // expected false
29
30// checking linkinfo() and is_link() on the link; expected: false
31var_dump( linkinfo($non_existent_linkname) );
32var_dump( is_link($non_existent_linkname) );
33
34echo "Done\n";
35?>
36--EXPECTF--
37*** Creating a hard link to a non-existent file ***
38
39Warning: link(): No such file or directory in %s on line %d
40bool(false)
41
42Warning: linkinfo(): No such file or directory in %s on line %d
43int(-1)
44bool(false)
45Done
46