cvs: php4(PHP_4_3) /main streams.c
| From: | Wez Furlong | Date: | Mon, 09 Dec 2002 10:34:32 +0000 |
| Subject: | cvs: php4(PHP_4_3) /main streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-17020@lists.php.net to get a copy of this message | ||
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);