[PHP] Re: How to escape a local path so fopen() doesn't consider it a URL?
- Date: Tue, 20 Dec 2016 14:06:46 +0100
- From: "Christoph M. Becker" <cmbecker69@xxxxxx>
- Subject: [PHP] Re: How to escape a local path so fopen() doesn't consider it a URL?
On 20.12.2016 at 07:58, Jesse Schalken wrote:
> fopen() supports being passed a URL for use with other "stream wrappers"
> besides the local file system.
> If I have a local file path that happens to look like a URL (for example, a
> file called "data:foo"), what is the correct escaping or manipulation that
> I have to do so that fopen() doesn't consider it a URL and it gets passed
> verbatim to fopen() in C?
Use an absolute path, or at least some qualification, such as
`./data:foo`. That is sufficient to tell PHP that you're not trying to
access a data URL. Whether it works, depends on the filesystem (doesn't
work on NTFS for instance, where colon is a reserved character).
Christoph M. Becker
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php