php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32234 Is a simbolic link a regular file?
Submitted: 2005-03-08 17:35 UTC Modified: 2005-03-08 18:02 UTC
From: adrian at autopublish dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.10 OS: Fedora Core 3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: adrian at autopublish dot com
New email:
PHP Version: OS:

 

 [2005-03-08 17:35 UTC] adrian at autopublish dot com
Description:
------------
The is_file() documentation page says:

  is_file -- Tells whether the filename is a regular file

If I pass a simbolic link to a file as parameter, the function returns true. So my question is: Is a simbolic link a regular file? I think it is not, so the result maybe a bug.


Extra info: The filetype() function returns "link".

Reproduce code:
---------------
Linux command line:

touch file
ln -s file link
echo '<? if (is_file("link")) echo "y\n"; ?>' | php -q

Expected result:
----------------
Nothing should be printed after last command.

Actual result:
--------------
"y" is printed, so the function is returning true.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-08 17:36 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

is_file and is_dir will resolve symlinks.
 [2005-03-08 18:02 UTC] adrian at autopublish dot com
Thanks.

I've posted a note to the is_file doc page:

http://www.php.net/manual/en/function.is-file.php
(will take some minutes to appear in all mirrors)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 23:01:34 2025 UTC