php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch 61565.diff for *Directory/Filesystem functions Bug #61565

Patch version 2012-03-31 10:04 UTC

Return to Bug #61565 | Download this patch
Patch Revisions:

Developer: ab@php.net

diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index caab03b..dd76600 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -515,11 +515,22 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
 			wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 TSRMLS_CC);
 
 			if (wrap) {
+				php_stream *stream;
 				php_stream_context *context = php_stream_context_from_zval(zcontext, 0);
+
+#if PHP_API_VERSION < 20100412 && defined PHP_WIN32
+				if (php_stream_stat_path_ex(buffer, 0, &ssb, context) == SUCCESS) {
+					if (ssb.sb.st_mode & S_IFDIR) {
+						ret_val = mime_directory;
+						goto common;
+					}
+				}
+#endif
+
 #if PHP_API_VERSION < 20100412
-				php_stream *stream = php_stream_open_wrapper_ex(buffer, "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
+				stream = php_stream_open_wrapper_ex(buffer, "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
 #else
-				php_stream *stream = php_stream_open_wrapper_ex(buffer, "rb", REPORT_ERRORS, NULL, context);
+				stream = php_stream_open_wrapper_ex(buffer, "rb", REPORT_ERRORS, NULL, context);
 #endif
 
 				if (!stream) {
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC