|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-07-06 14:05 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2021-07-06 14:05 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
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)