php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #101 fileperms & fileinode bombs on symlinked files
Submitted: 1998-02-24 20:11 UTC Modified: 1998-02-25 03:04 UTC
From: walshj at ns dot net Assigned:
Status: Closed Package: Other
PHP Version: 3.0b4 OS: Solaris 2.51
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: walshj at ns dot net
New email:
PHP Version: OS:

 

 [1998-02-24 20:11 UTC] walshj at ns dot net
I know that 3.0b5 and the CVS has the file_exists() function, but for previous version, I noticed that the fileperms()/fileinode() family of functions do not work correctly with symbolic links.   Say for example that "/etc/test/passwd" is a symbolic link to "/etc/passwd" (see below code).

$test = "/etc/test/passwd";
$file_exists = fileperms($test);
echo "test=", $file_exists;

All that is outputted is

test=

instead of the correct value or -1 if there's an error (the -1 stuff might have changed, but it's not documented in the PHP3 manuals).  If the file is not a symbolic link or doesn't have a symbolic link in its path, it works fine.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-02-25 03:04 UTC] jim
When the file does not exist, the various stat-like functions
return false, which doesn't echo anything when printed. Also, in
3.0b5 and later, you can use the file_exists() function instead
of "faking it" with one of the other file functions. This
makes your code much more readable.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 23:01:29 2024 UTC