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
 [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

Pull Requests

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: Sat Dec 14 04:01:26 2024 UTC