1
0
Fork 0

parse_url returns false for malformed urls, not null

pull/676/head
Matthew Brown 2018-10-04 14:21:47 -04:00 committed by GitHub
parent 18c6ccd137
commit daaf1f2980
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -38,7 +38,7 @@ function pathToUri(string $filepath): string
function uriToPath(string $uri) function uriToPath(string $uri)
{ {
$fragments = parse_url($uri); $fragments = parse_url($uri);
if ($fragments === null || !isset($fragments['scheme']) || $fragments['scheme'] !== 'file') { if ($fragments === false || !isset($fragments['scheme']) || $fragments['scheme'] !== 'file') {
throw new InvalidArgumentException("Not a valid file URI: $uri"); throw new InvalidArgumentException("Not a valid file URI: $uri");
} }
$filepath = urldecode($fragments['path']); $filepath = urldecode($fragments['path']);