php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73369 file_exists, is_file
Submitted: 2016-10-21 16:03 UTC Modified: 2016-10-21 23:19 UTC
From: gufophp at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.6.27 OS: linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gufophp at gmail dot com
New email:
PHP Version: OS:

Further comment on this bug is unnecessary.

 

 [2016-10-21 16:03 UTC] gufophp at gmail dot com
Description:
------------
incorrect is_file, file_exists

file is accessile

Test script:
---------------
echo $file = "ephp/eph_".$comando.".eph"; // use a relative path not absolute
require ($file);
this found and the file is inluded


if(is_file(file)){
require ($file);
}else{
// echo "il file esiste";
}


Expected result:
----------------
include a file




Actual result:
--------------
il file esiste

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-21 17:56 UTC] rasmus@php.net
You need to provide way more information here.
Plus your test script could never work. is_file(file) is missing a $
 [2016-10-21 19:39 UTC] gufophp at gmail dot com
The bug is real. I not have cut and paste.
 [2016-10-21 20:37 UTC] rasmus@php.net
-Status: Open +Status: Analyzed
 [2016-10-21 20:37 UTC] rasmus@php.net
That may be, but then you need to provide something we can go on.

for example:

    strace -o out php -r 'echo is_file("/bin/sh");'

Then in the out file, look for /bin/sh. On my Linux machine I see:

    stat("/bin/sh", {st_mode=S_IFREG|0755, st_size=113112, ...}) = 0
    write(1, "1", 1)                        = 1

The = 0 means the stat succeeded and then PHP writes 1 to the out. If this doesn't work on your system you have a filesystem-related problem of some kind. It is extremely unlikely that this is a PHP bug since all it does is do a stat() syscall under the covers.
 [2016-10-21 22:55 UTC] gufophp at gmail dot com
the line is identical for you
i have tested
    
    $file = "ephp/out";
    if(is_file($file)){
        include ($file);
    }

not include out

is_file("namefile.php") found
is_file("ephp/out") not works

$file = "ephp/eph_".$comando.".eph";
if(is_file(dirname(__FILE__)."/".$file)){
      require ($file);
} // works
 [2016-10-21 23:19 UTC] rasmus@php.net
-Status: Analyzed +Status: Not a bug -Block user comment: No +Block user comment: Yes
 [2016-10-21 23:19 UTC] rasmus@php.net
So look at the system calls and figure out why it isn't finding the file.
There is no PHP bug here.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 08:00:02 2026 UTC