Skip to content

Commit 0cdba53

Browse files
committed
Fix bug #61565 Fileinfo ext\fileinfo\tests\finfo_file_001.phpt fails
1 parent 55a6f3a commit 0cdba53

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

ext/fileinfo/fileinfo.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,22 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
515515
wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 TSRMLS_CC);
516516

517517
if (wrap) {
518+
php_stream *stream;
518519
php_stream_context *context = php_stream_context_from_zval(zcontext, 0);
520+
521+
#ifdef PHP_WIN32
522+
if (php_stream_stat_path_ex(buffer, 0, &ssb, context) == SUCCESS) {
523+
if (ssb.sb.st_mode & S_IFDIR) {
524+
ret_val = mime_directory;
525+
goto common;
526+
}
527+
}
528+
#endif
529+
519530
#if PHP_API_VERSION < 20100412
520-
php_stream *stream = php_stream_open_wrapper_ex(buffer, "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
531+
stream = php_stream_open_wrapper_ex(buffer, "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
521532
#else
522-
php_stream *stream = php_stream_open_wrapper_ex(buffer, "rb", REPORT_ERRORS, NULL, context);
533+
stream = php_stream_open_wrapper_ex(buffer, "rb", REPORT_ERRORS, NULL, context);
523534
#endif
524535

525536
if (!stream) {

0 commit comments

Comments
 (0)