refactor: fix impossible parse_url equality (#676)
`parse_url` returns `false` for malformed urls, not `null`pull/667/head v5.4.4
parent
680f430453
commit
ed2d8ddb1e
|
@ -38,7 +38,7 @@ function pathToUri(string $filepath): string
|
|||
function uriToPath(string $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");
|
||||
}
|
||||
$filepath = urldecode($fragments['path']);
|
||||
|
|
Loading…
Reference in New Issue