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