1--TEST-- 2Test symlink(), linkinfo(), link() and is_link() functions : usage variations - work on deleted link 3--SKIPIF-- 4<?php 5if (PHP_OS_FAMILY === 'Windows') { 6 require_once __DIR__ . '/windows_links/common.inc'; 7 skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__); 8} 9?> 10--FILE-- 11<?php 12/* Variation 5 : Creating link, deleting it and checking linkinfo(), is_link() on it */ 13 14$file_path = __DIR__; 15 16echo "*** Testing linkinfo() and is_link() on deleted link ***\n"; 17// link name used here 18$linkname = "$file_path/symlink_link_linkinfo_is_link_link_variation5.tmp"; 19 20// create temp dir 21$dirname = "$file_path/symlink_link_linkinfo_is_link_variation5"; 22mkdir($dirname); 23 24// filename used here 25$filename = "$dirname/symlink_link_linkinfo_is_link_variation5.tmp"; 26// create the file 27$fp = fopen($filename, "w"); 28$data = "Hello World"; 29fwrite($fp, $data); 30fclose($fp); 31 32var_dump( symlink($filename, $linkname) ); // create link 33 34// delete the link 35var_dump( unlink($linkname) ); // delete the link 36 37// clear the cache 38clearstatcache(); 39 40// try using linkinfo() & is_link() on deleted link; expected: false 41$deleted_link = $linkname; 42var_dump( linkinfo($deleted_link) ); 43var_dump( is_link($deleted_link) ); 44 45echo "Done\n"; 46?> 47--CLEAN-- 48<?php 49$file_path = __DIR__; 50$dirname = "$file_path/symlink_link_linkinfo_is_link_variation5"; 51$filename = "$dirname/symlink_link_linkinfo_is_link_variation5.tmp"; 52unlink($filename); 53rmdir($dirname); 54?> 55--EXPECTF-- 56*** Testing linkinfo() and is_link() on deleted link *** 57bool(true) 58bool(true) 59 60Warning: linkinfo(): No such file or directory in %s on line %d 61int(-1) 62bool(false) 63Done 64