Skip to content

Commit

Permalink
Disable file_exists check whenever a protocol format ^([\w.]+):\/\/ i…
Browse files Browse the repository at this point in the history
…s detected. (#85)
  • Loading branch information
bs-thomas authored Mar 3, 2023
1 parent cb0ea82 commit a1f4a52
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/XmlStringStreamer/Stream/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ public function __construct($mixed, $chunkSize = 16384, $chunkCallback = null)
// Account for common stream/URL wrappers before checking if a file exists
$realPath = $mixed;
if (preg_match('/^([\w.]+):\/\//', $realPath, $matched)) {
if (preg_match('/(http|ftp|php|data|ssh2)/', $matched[1])) {
// Disable file_exists() check
$realPath = null;
} else {
// Remove wrapper for file_exists() check.
$realPath = substr($realPath, strlen($matched[0]));
}
// Disable file_exists() check
$realPath = null;
}
// If there's a real disk path to check, make sure it exists
if ($realPath !== null && !file_exists($realPath)) {
Expand Down

0 comments on commit a1f4a52

Please sign in to comment.