php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10466 hidden '.' files don't work with file_exists()
Submitted: 2001-04-23 17:02 UTC Modified: 2001-04-24 12:16 UTC
From: atom at suspicious dot org Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.0.4pl1 OS: linux 2.4.2 (red-hat 6) i686
Private report: No CVE-ID: None
 [2001-04-23 17:02 UTC] atom at suspicious dot org
file_exists () seems to get confused with 'hidden' files, starting with '.' (dot).

this works fine:
--------------------------------------------------------------
if(file_exists(test/normal-file)) {
            die ("error message");
    }


this does not work:
--------------------------------------------------------------
if(file_exists(test/.hidden-file)) {
            die ("error message");
    }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-23 17:13 UTC] torben@php.net
Usually we like to have more information than 'doesn't work'. :)
But for the moment, what happens if you quote your strings?

i.e.:

if (file_exists('/file/names/must/be/.quoted.txt')) {
   . . .
}


 [2001-04-23 18:46 UTC] atom at suspicious dot org
single quotes works fine. thanks!

also, could be a bug, but i got it to work by having it ~follow~ a symbolic link.

it didn't check that the link existed, it checked the the place the link pointed to existed.
could be a security issue.

thanks... atom
 [2001-04-24 12:16 UTC] atom at suspicious dot org
single quotes solved it.

thanks...
 [2016-09-12 23:50 UTC] hanswienerschnitzel at gmail dot com
Thats it? And what if i got a hidden file name in a $var?
Since 2001 no fix?

Version:
PHP 7.0.8 (cli) (built: Jul 14 2016 00:43:00) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.8, Copyright (c) 1999-2016, by Zend Technologies
 [2016-09-13 11:22 UTC] hanswienerschnitzel at gmail dot com
Pls forget my comment.
There was a problem with my var.
My fault ofc.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC