]> granicus.if.org Git - php/commitdiff
Fix for bug #20831; include() from UNC paths does not work.
authorWez Furlong <wez@php.net>
Mon, 9 Dec 2002 10:34:32 +0000 (10:34 +0000)
committerWez Furlong <wez@php.net>
Mon, 9 Dec 2002 10:34:32 +0000 (10:34 +0000)
main/streams.c

index 5bd0d50c820977ff793d7ad6b29db5a9fbaa671c..4242d33538ac3123796d2f3a0eab091e496e5370 100755 (executable)
@@ -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);