wez             Mon Dec  9 05:38:35 2002 EDT

  Modified files:              
    /php4/main  streams.c 
  Log:
  MFB: #20831 fix
  
  
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.131 php4/main/streams.c:1.132
--- php4/main/streams.c:1.131   Fri Nov 22 20:24:08 2002
+++ php4/main/streams.c Mon Dec  9 05:38:35 2002
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.131 2002/11/23 01:24:08 helly Exp $ */
+/* $Id: streams.c,v 1.132 2002/12/09 10:38:35 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -1751,7 +1751,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);
@@ -2317,7 +2326,7 @@
                                return stream;
                        case PHP_STREAM_RELEASED:
 #if ZEND_DEBUG
-                               newstream->__orig_path = estrdup(copy_of_path);
+                               newstream->__orig_path = estrdup(path);
 #endif
                                return newstream;
                        default:
@@ -2339,8 +2348,9 @@
        }
        tidy_wrapper_error_log(wrapper TSRMLS_CC);
 #if ZEND_DEBUG
-       if (stream == NULL && copy_of_path != NULL)
+       if (stream == NULL && copy_of_path != NULL) {
                efree(copy_of_path);
+       }
 #endif
        return stream;
 }



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

Reply via email to