wez             Mon Dec  9 05:34:32 2002 EDT

  Modified files:              (Branch: PHP_4_3)
    /php4/main  streams.c 
  Log:
  Fix for bug #20831; include() from UNC paths does not work.
  
  
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.125.2.15 php4/main/streams.c:1.125.2.16
--- php4/main/streams.c:1.125.2.15      Fri Nov 22 20:17:39 2002
+++ php4/main/streams.c Mon Dec  9 05:34:32 2002
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.125.2.15 2002/11/23 01:17:39 helly Exp $ */
+/* $Id: streams.c,v 1.125.2.16 2002/12/09 10:34:32 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -1749,7 +1749,16 @@
        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);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to