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

Patch pecl_ares_osx_support.patch for ares Bug #63131

Patch version 2012-09-21 14:03 UTC

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

Developer: chobieeee@php.net

Index: config.m4
===================================================================
--- config.m4	(revision 327693)
+++ config.m4	(working copy)
@@ -21,7 +21,11 @@
 	dnl ##########
 	dnl newer versions of libcares need -lrt
 	dnl ##########
-	PHP_ADD_LIBRARY(rt, 1, ARES_SHARED_LIBADD)
+	case $host in
+		*linux*)
+		PHP_ADD_LIBRARY(rt, 1, ARES_SHARED_LIBADD)
+		;;
+	esac
 	
 	PHP_ARES_LIB=
 	PHP_CHECK_LIBRARY(cares, ares_init, [
Index: ares.c
===================================================================
--- ares.c	(revision 327693)
+++ ares.c	(working copy)
@@ -41,10 +41,14 @@
 #	include <arpa/nameser_compat.h>
 #endif
 
-#define local inline
+#ifdef __MACH__
+#	define local static
+#else
+#	define local inline
+#endif
 
 #ifndef ZEND_ENGINE_2
-#	define IS_CALLABLE(a,b,c) 1
+#	define PHP_ARES_IS_CALLABLE(a,b,c) 1
 #	ifndef ZTS
 #		undef TSRMLS_SET_CTX
 #		define TSRMLS_SET_CTX
@@ -54,10 +58,10 @@
 #endif
 #if (PHP_MAJOR_VERSION > 5) || ((PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION >= 3))
 #	define ADDREF(z) Z_ADDREF_P(z)
-#	define IS_CALLABLE(a,b,c) zend_is_callable((a), (b), (c) TSRMLS_CC)
+#	define PHP_ARES_IS_CALLABLE(a,b,c) zend_is_callable((a), (b), (c) TSRMLS_CC)
 #else
 #	define ADDREF(z) ZVAL_ADDREF(z)
-#	define IS_CALLABLE(a,b,c) zend_is_callable((a), (b), (c))
+#	define PHP_ARES_IS_CALLABLE(a,b,c) zend_is_callable((a), (b), (c))
 #endif
 
 #define PHP_ARES_LE_NAME "AsyncResolver"
@@ -758,7 +762,7 @@
 		
 		MAKE_STD_ZVAL(parsed);
 		ZVAL_NULL(parsed);
-		if (SUCCESS == php_ares_parse(abuf, alen, parsed)) {
+		if (SUCCESS == php_ares_parse(abuf, alen, parsed TSRMLS_CC)) {
 			q->result.std.arr = parsed;
 		} else {
 			zval_ptr_dtor(&parsed);
@@ -1135,7 +1139,7 @@
 	}
 	ZEND_FETCH_RESOURCE(ares, php_ares *, &rsrc, -1, PHP_ARES_LE_NAME, le_ares);
 	
-	if (cb && !IS_CALLABLE(cb, 0, NULL)) {
+	if (cb && !PHP_ARES_IS_CALLABLE(cb, 0, NULL)) {
 		RETURN_ARES_CB_ERROR("second");
 	}
 	
@@ -1162,7 +1166,7 @@
 	}
 	ZEND_FETCH_RESOURCE(ares, php_ares *, &rsrc, -1, PHP_ARES_LE_NAME, le_ares);
 	
-	if (cb && !IS_CALLABLE(cb, 0, NULL)) {
+	if (cb && !PHP_ARES_IS_CALLABLE(cb, 0, NULL)) {
 		RETURN_ARES_CB_ERROR("second");
 	}
 		
@@ -1188,7 +1192,7 @@
 	}
 	ZEND_FETCH_RESOURCE(ares, php_ares *, &rsrc, -1, PHP_ARES_LE_NAME, le_ares);
 	
-	if (cb && !IS_CALLABLE(cb, 0, NULL)) {
+	if (cb && !PHP_ARES_IS_CALLABLE(cb, 0, NULL)) {
 		RETURN_ARES_CB_ERROR("second");
 	}
 	
@@ -1215,7 +1219,7 @@
 	}
 	ZEND_FETCH_RESOURCE(ares, php_ares *, &rsrc, -1, PHP_ARES_LE_NAME, le_ares);
 	
-	if (cb && !IS_CALLABLE(cb, 0, NULL)) {
+	if (cb && !PHP_ARES_IS_CALLABLE(cb, 0, NULL)) {
 		RETURN_ARES_CB_ERROR("second");
 	}
 	
@@ -1244,7 +1248,7 @@
 	}
 	ZEND_FETCH_RESOURCE(ares, php_ares *, &rsrc, -1, PHP_ARES_LE_NAME, le_ares);
 	
-	if (cb && !IS_CALLABLE(cb, 0, NULL)) {
+	if (cb && !PHP_ARES_IS_CALLABLE(cb, 0, NULL)) {
 		PHP_ARES_CB_ERROR("second");
 		RETURN_FALSE;
 	}
@@ -1296,7 +1300,7 @@
 	}
 	ZEND_FETCH_RESOURCE(ares, php_ares *, &rsrc, -1, PHP_ARES_LE_NAME, le_ares);
 	
-	if (cb && !IS_CALLABLE(cb, 0, NULL)) {
+	if (cb && !PHP_ARES_IS_CALLABLE(cb, 0, NULL)) {
 		PHP_ARES_CB_ERROR("second");
 		RETURN_FALSE;
 	}
@@ -1877,16 +1881,22 @@
 	/* REGISTER_LONG_CONSTANT("ARES_T_KX", T_KX, CONST_CS|CONST_PERSISTENT); */
 	/* (37)  Certification record  */
 	/* REGISTER_LONG_CONSTANT("ARES_T_CERT", T_CERT, CONST_CS|CONST_PERSISTENT); */
+#ifdef T_A6
 	/* (38)  IPv6 address (deprecates AAAA)  */
 	REGISTER_LONG_CONSTANT("ARES_T_A6", T_A6, CONST_CS|CONST_PERSISTENT);
+#endif
+#ifdef T_DNAME
 	/* (39)  Non-terminal DNAME (for IPv6)  */
 	REGISTER_LONG_CONSTANT("ARES_T_DNAME", T_DNAME, CONST_CS|CONST_PERSISTENT);
+#endif
 	/* (40)  Kitchen sink (experimentatl)  */
 	/* REGISTER_LONG_CONSTANT("ARES_T_SINK", T_SINK, CONST_CS|CONST_PERSISTENT); */
 	/* (41)  EDNS0 option (meta-RR)  */
 	/* REGISTER_LONG_CONSTANT("ARES_T_OPT", T_OPT, CONST_CS|CONST_PERSISTENT); */
+#ifdef T_TSIG
 	/* (250)  Transaction signature.  */
 	REGISTER_LONG_CONSTANT("ARES_T_TSIG", T_TSIG, CONST_CS|CONST_PERSISTENT);
+#endif
 	/* (251)  Incremental zone transfer.  */
 	REGISTER_LONG_CONSTANT("ARES_T_IXFR", T_IXFR, CONST_CS|CONST_PERSISTENT);
 	/* (252)  Transfer zone of authority.  */
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 18:01:32 2024 UTC