--TEST--
Test symlink(), linkinfo(), link() and is_link() functions : usage variations - hardlink to non-existent file
- --SKIPIF--
- <?php
- if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip no symlinks on Windows');
- }
- ?>
--FILE--
<?php
-/* Prototype: bool symlink ( string $target, string $link );
- Description: creates a symbolic link to the existing target with the specified name link
-
- Prototype: bool is_link ( string $filename );
- Description: Tells whether the given file is a symbolic link.
-
- Prototype: bool link ( string $target, string $link );
- Description: Create a hard link
-
- Prototype: int linkinfo ( string $path );
- Description: Gets information about a link
-*/
-
/* Variation 2 : Create hard link to non-existent file */
$file_path = __DIR__;
--TEST--
Test symlink(), linkinfo(), link() and is_link() functions : usage variations - access/update file through hard link
- --SKIPIF--
- <?php
- if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip no symlinks on Windows');
- }
- ?>
--FILE--
<?php
-/* Prototype: bool symlink ( string $target, string $link );
- Description: creates a symbolic link to the existing target with the specified name link
-
- Prototype: bool is_link ( string $filename );
- Description: Tells whether the given file is a symbolic link.
-
- Prototype: bool link ( string $target, string $link );
- Description: Create a hard link
-
- Prototype: int linkinfo ( string $path );
- Description: Gets information about a link
-*/
-
/* Variation 4 : Create file and a hard link to the file
Access data of the file through the hard link
Update the file through hard link
if( $s1[0] == $linkinfo )
echo "\nlinkinfo() value matches lstat['dev']\n";
else
- echo "\nWarning: linkinfo() value doesnt match lstat['dev']\n";
+ echo "\nWarning: linkinfo() value doesn't match lstat['dev']\n";
// delete link
- unlink($soft_link);
+ if (PHP_OS_FAMILY === 'Windows') {
+ rmdir($soft_link);
+ } else {
+ unlink($soft_link);
+ }
echo "Done\n";
?>