Bug #76857 [Opn->Csd]: Can read “non-existant” files

From: Date: Mon, 28 Aug 2023 15:54:17 +0000
Subject: Bug #76857 [Opn->Csd]: Can read “non-existant” files
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245273@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76857&edit=1 ID: 76857 Updated by: git@php.net Reported by: cmb@php.net Summary: Can read “non-existant” files -Status: Open +Status: Closed Type: Bug Package: Streams related Operating System: Linux PHP Version: master-Git-2018-09-10 (Git) Block user comment: N Private report: N New Comment: Automatic comment on behalf of bukka Revision: https://github.com/php/php-src/commit/766cac072f396dd0914d9d8f1209b673d54b61c1 Log: Fix bug #76857: Can read &quot;non-existant&quot; files Previous Comments: ------------------------------------------------------------------------ [2018-09-10 14:38:13] cmb@php.net 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 this bug report at https://bugs.php.net/bug.php?id=76857&edit=1

« previous php.bugs (#245273) next »