Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug #76857: Can read "non-existant" files
This change makes checked and opened file consistent in a way that it is using real path for stat operation in the same way like it is used for open. Closes GH-12067
- Loading branch information
Showing
4 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
Bug #76857 (Can read "non-existant" files) | ||
--FILE-- | ||
<?php | ||
file_put_contents(__DIR__ . '/bug76857_data.txt', 'test data'); | ||
$path = "foobar://google.com/../../bug76857_data.txt"; | ||
chdir(__DIR__); | ||
var_dump(file_exists($path)); | ||
var_dump(file_get_contents($path, false, null, 0, 10)); | ||
?> | ||
--EXPECTF-- | ||
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(9) "test data" | ||
--CLEAN-- | ||
<?php | ||
@unlink(__DIR__ . '/bug76857_data.txt'); | ||
?> |
766cac0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo in the comment, it actually closes GH-12065
766cac0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to have introduced an ~8% performance degradation for the symfony demo. WordPress differs not much OTOH.
766cac0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah looking to some improvements
766cac0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the notification
766cac0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first attempt to fix it in #12068