Bug #74693 [NEW]: is_file doesn't parse php://filter format

From: Date: Fri, 02 Jun 2017 14:46:07 +0000
Subject: Bug #74693 [NEW]: is_file doesn't parse php://filter format
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209367@lists.php.net to get a copy of this message
From: ed at rgsystem dot com Operating system: Probably ALL PHP version: 5.6.30 Package: Streams related Bug Type: Bug Bug description:is_file doesn't parse php://filter format 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 bug report at https://bugs.php.net/bug.php?id=74693&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74693&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74693&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74693&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74693&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74693&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74693&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74693&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74693&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74693&r=support Expected behavior: https://bugs.php.net/fix.php?id=74693&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74693&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74693&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74693&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74693&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74693&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74693&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74693&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74693&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74693&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74693&r=mysqlcfg

« previous php.bugs (#209367) next »