diff options
author | Wez Furlong <wez@php.net> | 2002-12-09 10:38:35 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2002-12-09 10:38:35 +0000 |
commit | 164130ed2289e143ff69ee22e12590adf5b688b3 (patch) | |
tree | ccab348490b56a97b6e1fdc8c3e613b08a450e71 | |
parent | 9283ff3ab6347b2add77118bf440f52285647f66 (diff) | |
download | php-git-164130ed2289e143ff69ee22e12590adf5b688b3.tar.gz |
MFB: #20831 fix
-rwxr-xr-x | main/streams.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/main/streams.c b/main/streams.c index 89288f52e8..e2583673ac 100755 --- a/main/streams.c +++ b/main/streams.c @@ -1751,7 +1751,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); @@ -2317,7 +2326,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio 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 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio } 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; } |