Bug #76857 [NEW]: Can read ânon-existantâ files
| From: | cmb@php.net | Date: | Mon, 10 Sep 2018 14:38:13 +0000 |
| Subject: | Bug #76857 [NEW]: Can read ânon-existantâ files | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-216959@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: Linux
PHP version: master-Git-2018-09-10 (Git)
Package: Streams related
Bug Type: Bug
Bug description:Can read ânon-existantâ files
Description:
------------
If an URL with an unsupported protocol is passed to filesystem
functions, they treat it as local file path (after raising an
E_WARNING). On Linux, however, file_get_contents() and others may
succeed, even if file_exists() returns FALSE (Windows returns
TRUE).
The test script is supposed to be placed in
ext/standard/tests/streams/ and to be run from the php-src root.
Test script:
---------------
<?php
$path = "foobar://google.com/../../INSTALL";
var_dump(file_exists($path));
var_dump(file_get_contents($path, false, null, 0, 10));
?>
Expected result:
----------------
Warning: file_exists(): Unable to find the wrapper "foobar" - did you
forget to enable it when you configured PHP? in %s on line %d
bool(true)
Warning: file_get_contents(): Unable to find the wrapper "foobar" - did
you forget to enable it when you configured PHP? in %s on line %d
string(10) "For instal"
Actual result:
--------------
Warning: file_exists(): Unable to find the wrapper "foobar" - did you
forget to enable it when you configured PHP? in %s on line %d
bool(false)
Warning: file_get_contents(): Unable to find the wrapper "foobar" - did
you forget to enable it when you configured PHP? in %s on line %d
string(10) "For instal"
--
Edit bug report at https://bugs.php.net/bug.php?id=76857&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76857&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76857&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76857&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76857&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76857&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76857&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76857&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76857&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76857&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76857&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76857&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76857&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76857&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76857&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76857&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76857&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76857&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76857&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76857&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76857&r=mysqlcfg