From 5650d9fdd1ff183d73b0cbc3c9529e3b2652ac51 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 9 Dec 2002 10:34:32 +0000 Subject: [PATCH] Fix for bug #20831; include() from UNC paths does not work. --- main/streams.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main/streams.c b/main/streams.c index 5bd0d50c82..4242d33538 100755 --- a/main/streams.c +++ b/main/streams.c @@ -1749,7 +1749,16 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha if (fp) { /* sanity checks for include/require */ if (options & STREAM_OPEN_FOR_INCLUDE && (fstat(fileno(fp), &st) == -1 || !S_ISREG(st.st_mode))) { - goto err; + int is_unc = 0; + +#ifdef PHP_WIN32 + /* skip the sanity check; fstat doesn't appear to work on + * UNC paths */ + is_unc = (filename[0] == '\\' && filename[1] == '\\'); +#endif + if (!is_unc) { + goto err; + } } ret = php_stream_fopen_from_file_rel(fp, mode); -- 2.40.0