|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74693 is_file doesn't parse php://filter format
Submitted: 2017-06-02 14:45 UTC Modified: 2021-07-06 14:05 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ed at rgsystem dot com Assigned: cmb (profile)
Status: Not a bug Package: Streams related
PHP Version: 5.6.30 OS: Probably ALL
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.
Bug Type:
From: ed at rgsystem dot com
New email:
PHP Version: OS:


 [2017-06-02 14:45 UTC] ed at rgsystem dot com
is_file method (probably all filestat method based) is not taking into account the php://filter shape when describing a file to open. This is pretty normal to write code like that:
if (is_file($path))
    throw new \Exception("File exists");

$file = open($path);

Unfortunately, is_file will always return false when a filter is used

Note: this issue is probably affecting ALL php versions

Test script:
ed@test:~$ php -v
PHP 5.6.29-0+deb8u1 (cli) (built: Dec 13 2016 16:02:08)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
ed@test:~$ php -r 'var_dump(is_file("test"));'
ed@test:~$ php -r 'var_dump(is_file("php://filter/read=string.toupper/resource=test"));'
ed@test:~$ touch test
ed@test:~$ php -r 'var_dump(is_file("test"));'
ed@test:~$ php -r 'var_dump(is_file("php://filter/read=string.toupper/resource=test"));'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-06 14:05 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2021-07-06 14:05 UTC]
That behaves as expected, because php://filter streams don't
support stat[1].  Given that this issue got no further traction,
I'm closing as not a bug.

If you still think this should be supported, feel free to pursue
the RFC process[2].

[1] <>
[2] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 05 05:01:29 2024 UTC