Re: How to escape a local path so fopen() doesn't consider it a URL?

From: Date: Wed, 21 Dec 2016 23:03:50 +0000
Subject: Re: How to escape a local path so fopen() doesn't consider it a URL?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-325913@lists.php.net to get a copy of this message
Whoops again, the test should be for a scheme of 2 or more characters, not 1 or more (so it doesn't match C://foo): function make_path_local(string $path): string { if (\preg_match('/^([a-zA-Z0-9+\\-.]{2,}:\\/\\/|data:|zlib:)/Ds', $path)) return '.' . \DIRECTORY_SEPARATOR . $path; return $path; } ​

« previous php.general (#325913) next »