php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #66095
Patch libmagic-static-symbols revision 2013-11-14 14:00 UTC by vitalif at mail dot ru

Patch libmagic-static-symbols for Unknown/Other Function Bug #66095

Patch version 2013-11-14 14:00 UTC

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

Developer: vitalif@mail.ru

--- ext/fileinfo/config.m4	2013-10-15 17:49:47.000000000 +0400
+++ ext/fileinfo/config.m4	2013-11-14 17:11:30.000000000 +0400
@@ -12,8 +12,8 @@ if test "$PHP_FILEINFO" != "no"; then
     libmagic/encoding.c libmagic/fsmagic.c libmagic/funcs.c \
     libmagic/is_tar.c libmagic/magic.c libmagic/print.c \
     libmagic/readcdf.c libmagic/readelf.c libmagic/softmagic.c"
-
-  PHP_NEW_EXTENSION(fileinfo, fileinfo.c $libmagic_sources, $ext_shared,,-I@ext_srcdir@/libmagic)
+  # $libmagic_sources
+  PHP_NEW_EXTENSION(fileinfo, fileinfo.c, $ext_shared,,-I@ext_srcdir@/libmagic)
   PHP_ADD_BUILD_DIR($ext_builddir/libmagic)
 
   AC_CHECK_FUNCS([utimes strndup])
--- ext/fileinfo/fileinfo.c	2013-10-15 17:49:47.000000000 +0400
+++ ext/fileinfo/fileinfo.c	2013-11-14 17:16:24.000000000 +0400
@@ -23,7 +23,22 @@
 #endif
 #include "php.h"
 
-#include <magic.h>
+#include "apprentice.c"
+#include "apptype.c"
+#include "ascmagic.c"
+#include "cdf.c"
+#include "cdf_time.c"
+#include "compress.c"
+#include "encoding.c"
+#include "fsmagic.c"
+#include "softmagic.c"
+#include "funcs.c"
+#include "is_tar.c"
+#include "magic.c"
+#include "print.c"
+#include "readcdf.c"
+#include "readelf.c"
+
 /* 
  * HOWMANY specifies the maximum offset libmagic will look at
  * this is currently hardcoded in the libmagic source but not exported
--- ext/fileinfo/libmagic/file.h	2013-10-15 17:49:47.000000000 +0400
+++ ext/fileinfo/libmagic/file.h	2013-11-14 17:12:23.000000000 +0400
@@ -91,6 +91,9 @@
 
 #define private static
 
+#define protected static
+#define public static
+/*
 #if HAVE_VISIBILITY
 #define public  __attribute__ ((__visibility__("default")))
 #ifndef protected
@@ -101,7 +104,7 @@
 #ifndef protected
 #define protected
 #endif
-#endif
+#endif*/
 
 #ifndef __arraycount
 #define __arraycount(a) (sizeof(a) / sizeof(a[0]))
@@ -497,6 +500,7 @@ ssize_t getdelim(char **dst, size_t *len
 #define O_BINARY	0
 #endif
 
+/*
 #ifndef __cplusplus
 #if defined(__GNUC__) && (__GNUC__ >= 3)
 #define FILE_RCSID(id) \
@@ -507,9 +511,9 @@ static const char *rcsid(const char *p)
 	return rcsid(p = id); \
 }
 #endif
-#else
+#else*/
 #define FILE_RCSID(id)
-#endif
+//#endif
 
 #ifdef PHP_WIN32
 #define FINFO_LSEEK_FUNC _lseek
--- ext/fileinfo/libmagic/funcs.c	2013-10-15 17:49:47.000000000 +0400
+++ ext/fileinfo/libmagic/funcs.c	2013-11-14 17:14:12.000000000 +0400
@@ -50,7 +50,7 @@ FILE_RCSID("@(#)$File: funcs.c,v 1.61 20
 # define PREG_OFFSET_CAPTURE                 (1<<8)
 #endif
 
-extern public void convert_libmagic_pattern(zval *pattern, int options);
+//extern public void convert_libmagic_pattern(zval *pattern, int options);
 
 /*
  * Like printf, only we append to a buffer.
--- ext/fileinfo/libmagic/magic.h	2013-10-15 17:49:47.000000000 +0400
+++ ext/fileinfo/libmagic/magic.h	2013-11-14 17:15:24.000000000 +0400
@@ -82,23 +82,23 @@ extern "C" {
 #endif
 
 typedef struct magic_set *magic_t;
-magic_t magic_open(int);
-void magic_close(magic_t);
+public magic_t magic_open(int);
+public void magic_close(magic_t);
 
-const char *magic_getpath(const char *, int);
-const char *magic_file(magic_t, const char *);
-const char *magic_stream(magic_t, php_stream *);
-const char *magic_descriptor(magic_t, int);
-const char *magic_buffer(magic_t, const void *, size_t);
+public const char *magic_getpath(const char *, int);
+public const char *magic_file(magic_t, const char *);
+public const char *magic_stream(magic_t, php_stream *);
+public const char *magic_descriptor(magic_t, int);
+public const char *magic_buffer(magic_t, const void *, size_t);
 
-const char *magic_error(magic_t);
-int magic_setflags(magic_t, int);
+public const char *magic_error(magic_t);
+public int magic_setflags(magic_t, int);
 
-int magic_version(void);
-int magic_load(magic_t, const char *);
-int magic_compile(magic_t, const char *);
-int magic_list(magic_t, const char *);
-int magic_errno(magic_t);
+public int magic_version(void);
+public int magic_load(magic_t, const char *);
+public int magic_compile(magic_t, const char *);
+public int magic_list(magic_t, const char *);
+public int magic_errno(magic_t);
 
 #ifdef __cplusplus
 };
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Oct 18 08:01:26 2019 UTC