1--TEST-- 2Test is_file() function: usage variations - links 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) == 'WIN') { 6 die('skip Do not run on Windows'); 7} 8--FILE-- 9<?php 10/* Prototype: bool is_file ( string $filename ); 11 Description: Tells whether the filename is a regular file 12 Returns TRUE if the filename exists and is a regular file 13*/ 14 15/* Creating soft and hard links to a file and applying is_file() on links */ 16 17$file_path = dirname(__FILE__); 18fclose( fopen($file_path."/is_file_variation2.tmp", "w") ); 19 20echo "*** Testing is_file() with links ***\n"; 21/* With symlink */ 22symlink($file_path."/is_file_variation2.tmp", $file_path."/is_file_variation2_symlink.tmp"); 23var_dump( is_file($file_path."/is_file_variation2_symlink.tmp") ); //expected true 24clearstatcache(); 25 26/* With hardlink */ 27link($file_path."/is_file_variation2.tmp", $file_path."/is_file_variation2_link.tmp"); 28var_dump( is_file($file_path."/is_file_variation2_link.tmp") ); // expected: true 29clearstatcache(); 30 31echo "\n*** Done ***"; 32?> 33--CLEAN-- 34<?php 35$file_path = dirname(__FILE__); 36unlink($file_path."/is_file_variation2_symlink.tmp"); 37unlink($file_path."/is_file_variation2_link.tmp"); 38unlink($file_path."/is_file_variation2.tmp"); 39?> 40--EXPECTF-- 41*** Testing is_file() with links *** 42bool(true) 43bool(true) 44 45*** Done *** 46