php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #63248
Patch bug63248.patch revision 2012-10-13 21:08 UTC by ab@php.net
revision 2012-10-11 15:42 UTC by ab@php.net
revision 2012-10-10 17:51 UTC by ab@php.net

Patch bug63248.patch for *General Issues Bug #63248

Patch version 2012-10-11 15:42 UTC

Return to Bug #63248 | Download this patch
This patch is obsolete

Obsoleted by patches:

This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: ab@php.net

diff --git a/ext/fileinfo/config.w32 b/ext/fileinfo/config.w32
index 46b87b5..9226387 100644
--- a/ext/fileinfo/config.w32
+++ b/ext/fileinfo/config.w32
@@ -4,22 +4,19 @@
 ARG_ENABLE("fileinfo", "fileinfo support", "no");
 
 if (PHP_FILEINFO != 'no') {
-	if (CHECK_HEADER_ADD_INCLUDE("dirent.h", "CFLAGS_FILEINFO") &&
-			CHECK_LIB("dirent_a.lib", "fileinfo", PHP_FILEINFO)) { 
-		LIBMAGIC_SOURCES=" apprentice.c apptype.c ascmagic.c \
-				cdf.c cdf_time.c compress.c \
-				encoding.c fsmagic.c funcs.c \
-				is_tar.c magic.c print.c \
-				readcdf.c readelf.c softmagic.c";
+	LIBMAGIC_SOURCES=" apprentice.c apptype.c ascmagic.c \
+			cdf.c cdf_time.c compress.c \
+			encoding.c fsmagic.c funcs.c \
+			is_tar.c magic.c print.c \
+			readcdf.c readelf.c softmagic.c";
 
-		if (VCVERS < 1500) {
-			ADD_FLAG('CFLAGS', '/Zm1000');
-		}
+	if (VCVERS < 1500) {
+		ADD_FLAG('CFLAGS', '/Zm1000');
+	}
 
-		EXTENSION('fileinfo', 'fileinfo.c', true, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
-		ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo");
-	} else {
-		WARNING("fileinfo not enabled; libraries and headers not found");
-		PHP_FILEINFO = "no";
-	} 
+	EXTENSION('fileinfo', 'fileinfo.c', true, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
+	ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo");
+	if (PHP_FILEINFO_SHARED) {
+		DEFINE('FILEINFO_GLOBAL_OBJS', configure_subst.Item('FILEINFO_GLOBAL_OBJS') + ' $(BUILD_DIR)\\win32\\readdir.obj');
+	}
 }
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c
index d11bd15..097288a 100644
--- a/ext/fileinfo/libmagic/apprentice.c
+++ b/ext/fileinfo/libmagic/apprentice.c
@@ -64,7 +64,7 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.173 2011/12/08 12:38:24 rrt Exp $")
 #include <ctype.h>
 #include <fcntl.h>
 #ifndef PHP_WIN32
-#include <dirent.h>
+#include <win32/readdir.h>
 #endif
 
 #define	EATAB {while (isascii((unsigned char) *l) && \
@@ -2206,6 +2206,14 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
 		goto internal_loaded;
 	}
 
+#ifdef PHP_WIN32
+       if (php_stream_stat_path_ex(fn, 0, &st, NULL) == SUCCESS) {
+               if (st.sb.st_mode & S_IFDIR) {
+                       goto error2;
+               }
+       }
+#endif
+
 	dbname = mkdbname(ms, fn, 0);
 	if (dbname == NULL)
 		goto error2;
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 01:01:56 2014 UTC