Bug #74693 [Opn->Nab]: is_file doesn't parse php://filter format
| From: | cmb@php.net | Date: | Tue, 06 Jul 2021 14:05:41 +0000 |
| Subject: | Bug #74693 [Opn->Nab]: is_file doesn't parse php://filter format | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234819@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74693&edit=1
ID: 74693
Updated by: cmb@php.net
Reported by: ed at rgsystem dot com
Summary: is_file doesn't parse php://filter format
-Status: Open
+Status: Not a bug
Type: Bug
Package: Streams related
Operating System: Probably ALL
PHP Version: 5.6.30
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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] <https://www.php.net/manual/en/wrappers.php.php>
[2] <https://wiki.php.net/rfc/howto>
Previous Comments:
------------------------------------------------------------------------
[2017-06-02 14:45:58] ed at rgsystem dot com
Description:
------------
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"));'
bool(false)
ed@test:~$ php -r
'var_dump(is_file("php://filter/read=string.toupper/resource=test"));'
bool(false)
ed@test:~$ touch test
ed@test:~$ php -r 'var_dump(is_file("test"));'
bool(true)
ed@test:~$ php -r
'var_dump(is_file("php://filter/read=string.toupper/resource=test"));'
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74693&edit=1