Merge branch 'geoip-php7' into 'master'
Geoip php7 See merge request !75
This commit is contained in:
		
						commit
						bf33760492
					
				
					 5 changed files with 587 additions and 0 deletions
				
			
		
							
								
								
									
										5
									
								
								dev-php/pecl-geoip/ChangeLog
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								dev-php/pecl-geoip/ChangeLog
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
|   07 Jun 2016;  <manuel@fritteli.ch> | ||||
|   files/pecl-geoip-1.1.0.9999-patch-to-svn-r337409.patch, | ||||
|   pecl-geoip-1.1.0.9999.ebuild: | ||||
|   Added ebuild for pecl-geoip that sould be compatible with PHP 7 | ||||
| 
 | ||||
							
								
								
									
										5
									
								
								dev-php/pecl-geoip/Manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								dev-php/pecl-geoip/Manifest
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| AUX pecl-geoip-1.1.0.9999-patch-to-svn-r337409.patch 13475 SHA256 2a14d4bb09c1ded394ee588f37f8a1959262abcd2679cac84acf2d6638ff5924 SHA512 c37dd0b41df0fbf55a91575bbc6cbb1da92bef4d47e8e660c4e715fc0d424e53a7d2657c996878faedf03a5d92b4ff0b5d466097e22f525818c93483ac158c99 WHIRLPOOL 4f9f117f154ce73702ad92056b880189777494eee414455afe126d03135f8efbb3bc5aedadda5874536302896488e77642f9084930e4c9407426a8e82f27301f | ||||
| DIST geoip-1.1.0.tgz 12714 SHA256 82c6deb7264d2ff7c4d6c45a7d27cff7ab097be965795e317e04a9c5b7be98b9 SHA512 8a0fc698a234d3b2c01f2a0c05c28025d98a5d3dce509ba19ee462abae0fd0f5631d96d3e8bba4fce6c23b278ec3875da5e8535971c7d880e2e307a097dc30a1 WHIRLPOOL f8ccf90958bdc0eee41f24b6ad04907884fed2efe2bca483fa816aceb46d15311325175b07f27d85085afdb5651fd071fd20b046ba42e30da26eea56a14912d6 | ||||
| EBUILD pecl-geoip-1.1.0.9999.ebuild 780 SHA256 2de773c29101b273afde935b70c1bb1e3a22c2409eca8646b2df2f7de0f66d61 SHA512 a579d0f7a36a84011dcc3d0d724776a3214c2309bb71c325ad39a5d6aa35246220cf0089e2e97c37eaee07e8166b3080386ecffc459c5e539e60d6abc9029af4 WHIRLPOOL a8c1882617a99917ce4dc789d23dc78ee854eaa93b8cb4843e8d25c52851e896ae6ea9689b199c83b27efbbe4ceef880015f1de67e1a1aa9e2edb3e410853137 | ||||
| MISC ChangeLog 194 SHA256 ef807fc2efd88937acdbe810cf875fa658dfe2d3771332f46c20f03ce5b9c491 SHA512 334862d9aee9d514a2d3885df39a047fc6fafb140bf02df5f80cb658a736543d8c2f1ac7845d373403d98d3ee4bf90202c7a8d88dc569ba365f291f08b4a3c38 WHIRLPOOL a82649d1024ce77054e4a7326948377aaf4769ff5c4fb3232e519447eca04809479902a2f94f4313f650bfe0b7301f434aa59bd44b36d70e0f1c7865671b9e1e | ||||
| MISC metadata.xml 234 SHA256 f35b97f99a26d73cc441e1d93bfe25aaa4e9f7f6d90c8d05a74f7b7bc5b68472 SHA512 59d8156b3ca3e99c40d5a2a32de7edf2eb53279b2424998862589d6bad77617d23fc852afec0a92f8ac5bb54a88ebc504cc0641029c1936412e90ab03dfdd447 WHIRLPOOL 935a1401910a42f888c991e443a49275ea8b87976c5aa977f670053d97d18754231749749bc92d37d4b5f45ecf65914480942a11b5827b6c08fb24313a428431 | ||||
|  | @ -0,0 +1,526 @@ | |||
| Index: trunk/geoip.def
 | ||||
| ===================================================================
 | ||||
| --- trunk/geoip.def	(revision 333461)
 | ||||
| +++ trunk/geoip.def	(revision 337409)
 | ||||
| @@ -21,7 +21,7 @@
 | ||||
|  GEOIPDEF(geoip_country_code3_by_name,	GeoIP_country_code3_by_name,	GEOIP_COUNTRY_EDITION) | ||||
|  GEOIPDEF(geoip_country_name_by_name,	GeoIP_country_name_by_name,	GEOIP_COUNTRY_EDITION) | ||||
|   | ||||
| -#if LIBGEOIP_VERSION >= 1004005 && FALSE
 | ||||
| +#if LIBGEOIP_VERSION >= 1004005
 | ||||
|  GEOIPDEF(geoip_country_code_by_name_v6,	GeoIP_country_code_by_name_v6,	GEOIP_COUNTRY_EDITION_V6) | ||||
|  GEOIPDEF(geoip_country_code3_by_name_v6,	GeoIP_country_code3_by_name_v6,	GEOIP_COUNTRY_EDITION_V6) | ||||
|  GEOIPDEF(geoip_country_name_by_name_v6,	GeoIP_country_name_by_name_v6,	GEOIP_COUNTRY_EDITION_V6) | ||||
| Index: trunk/php_geoip.h
 | ||||
| ===================================================================
 | ||||
| --- trunk/php_geoip.h	(revision 333461)
 | ||||
| +++ trunk/php_geoip.h	(revision 337409)
 | ||||
| @@ -24,8 +24,12 @@
 | ||||
|  extern zend_module_entry geoip_module_entry; | ||||
|  #define phpext_geoip_ptr &geoip_module_entry | ||||
|   | ||||
| -#define PHP_GEOIP_VERSION "1.1.0"
 | ||||
| +#define PHP_GEOIP_VERSION "1.1.1-dev"
 | ||||
|   | ||||
| +#if PHP_MAJOR_VERSION < 7
 | ||||
| +typedef long zend_long;
 | ||||
| +#endif
 | ||||
| +
 | ||||
|  #ifdef PHP_WIN32 | ||||
|  #define PHP_GEOIP_API __declspec(dllexport) | ||||
|  #else | ||||
| Index: trunk/config.m4
 | ||||
| ===================================================================
 | ||||
| --- trunk/config.m4	(revision 333461)
 | ||||
| +++ trunk/config.m4	(revision 337409)
 | ||||
| @@ -43,7 +43,7 @@
 | ||||
|   | ||||
|    PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, | ||||
|    [ | ||||
| -    PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $GEOIP_DIR/lib, GEOIP_SHARED_LIBADD)
 | ||||
| +    PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $GEOIP_DIR/$PHP_LIBDIR, GEOIP_SHARED_LIBADD)
 | ||||
|      AC_DEFINE(HAVE_GEOIPLIB,1,[ ]) | ||||
|    ],[ | ||||
|      AC_MSG_ERROR([wrong geoip lib version or lib not found]) | ||||
| @@ -95,8 +95,7 @@
 | ||||
|    AC_CHECK_DECL(GEOIP_NETSPEED_EDITION_REV1, | ||||
|    [ | ||||
|      MIN_GEOIP_VERSION=1004008 | ||||
| -  ],[
 | ||||
| -  ],[
 | ||||
| +  ],[],[
 | ||||
|      #include <GeoIP.h> | ||||
|    ]) | ||||
|     | ||||
| @@ -104,8 +103,7 @@
 | ||||
|    AC_CHECK_DECL(GEOIP_ACCURACYRADIUS_EDITION, | ||||
|    [ | ||||
|      MIN_GEOIP_VERSION=1005000 | ||||
| -  ],[
 | ||||
| -  ],[
 | ||||
| +  ],[],[
 | ||||
|      #include <GeoIP.h> | ||||
|    ]) | ||||
|     | ||||
| Index: trunk/geoip.c
 | ||||
| ===================================================================
 | ||||
| --- trunk/geoip.c	(revision 333461)
 | ||||
| +++ trunk/geoip.c	(revision 337409)
 | ||||
| @@ -117,7 +117,7 @@
 | ||||
|  #endif | ||||
|   | ||||
|  	GeoIP_setup_custom_directory(value); | ||||
| -	_GeoIP_setup_dbfilename();
 | ||||
| +	GeoIP_db_avail(GEOIP_COUNTRY_EDITION);
 | ||||
|  } | ||||
|  /* }}} */ | ||||
|  #endif | ||||
| @@ -129,11 +129,19 @@
 | ||||
|  { | ||||
|  	if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) { | ||||
|  		GEOIP_G(set_runtime_custom_directory) = 1; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +		geoip_change_custom_directory(new_value->val);
 | ||||
| +#else
 | ||||
|  		geoip_change_custom_directory(new_value); | ||||
| +#endif
 | ||||
|  		return SUCCESS; | ||||
|  	} | ||||
|  	 | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
 | ||||
| +#else
 | ||||
|  	return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); | ||||
| +#endif
 | ||||
|  } | ||||
|  /* }}} */ | ||||
|  #endif | ||||
| @@ -168,7 +176,8 @@
 | ||||
|  #ifdef HAVE_CUSTOM_DIRECTORY | ||||
|  	GeoIP_setup_custom_directory(GEOIP_G(custom_directory)); | ||||
|  #endif | ||||
| -	_GeoIP_setup_dbfilename();
 | ||||
| +	/* This will initialize file structure */
 | ||||
| +	GeoIP_db_avail(GEOIP_COUNTRY_EDITION);
 | ||||
|  	 | ||||
|  	/* For database type constants */ | ||||
|  	REGISTER_LONG_CONSTANT("GEOIP_COUNTRY_EDITION",     GEOIP_COUNTRY_EDITION,     CONST_CS | CONST_PERSISTENT); | ||||
| @@ -250,7 +259,7 @@
 | ||||
|  /* {{{ proto boolean geoip_db_avail( [ int database ] ) */ | ||||
|  PHP_FUNCTION(geoip_db_avail) | ||||
|  { | ||||
| -	long edition;
 | ||||
| +	zend_long edition;
 | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &edition) == FAILURE) { | ||||
|  		return; | ||||
| @@ -269,7 +278,7 @@
 | ||||
|  /* {{{ proto string geoip_db_filename( [ int database ] ) */ | ||||
|  PHP_FUNCTION(geoip_db_filename) | ||||
|  { | ||||
| -	long edition;
 | ||||
| +	zend_long edition;
 | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &edition) == FAILURE) { | ||||
|  		return; | ||||
| @@ -282,7 +291,11 @@
 | ||||
|  	} | ||||
|  	 | ||||
|  	if (NULL != GeoIPDBFileName[edition]) | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +		RETURN_STRING(GeoIPDBFileName[edition]);	
 | ||||
| +#else
 | ||||
|  		RETURN_STRING(GeoIPDBFileName[edition], 1);	 | ||||
| +#endif
 | ||||
|  } | ||||
|  /* }}} */ | ||||
|   | ||||
| @@ -297,16 +310,31 @@
 | ||||
|  	{ | ||||
|  		if (NULL != GeoIPDBDescription[i]) | ||||
|  		{ | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +			zval real_row;
 | ||||
| +			zval *row = &real_row;
 | ||||
| +
 | ||||
| +			array_init(row);
 | ||||
| +#else
 | ||||
|  			zval *row; | ||||
|  			ALLOC_INIT_ZVAL(row); | ||||
|  			array_init(row); | ||||
| +#endif
 | ||||
|   | ||||
|  			add_assoc_bool(row, "available", GeoIP_db_avail(i)); | ||||
|  			if (GeoIPDBDescription[i]) { | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +				add_assoc_string(row, "description", (char *)GeoIPDBDescription[i]);
 | ||||
| +#else
 | ||||
|  				add_assoc_string(row, "description", (char *)GeoIPDBDescription[i], 1); | ||||
| +#endif
 | ||||
|  			} | ||||
|  			if (GeoIPDBFileName[i]) { | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +				add_assoc_string(row, "filename", GeoIPDBFileName[i]);
 | ||||
| +#else
 | ||||
|  				add_assoc_string(row, "filename", GeoIPDBFileName[i], 1); | ||||
| +#endif
 | ||||
|  			} | ||||
|   | ||||
|  			add_index_zval(return_value, i, row); | ||||
| @@ -321,7 +349,7 @@
 | ||||
|  { | ||||
|  	GeoIP * gi; | ||||
|  	char * db_info; | ||||
| -	long edition = GEOIP_COUNTRY_EDITION;
 | ||||
| +	zend_long edition = GEOIP_COUNTRY_EDITION;
 | ||||
|  	 | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &edition) == FAILURE) { | ||||
|  		return; | ||||
| @@ -346,12 +374,17 @@
 | ||||
|  	db_info = GeoIP_database_info(gi); | ||||
|  	GeoIP_delete(gi); | ||||
|   | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	RETVAL_STRING(db_info);
 | ||||
| +#else
 | ||||
|  	RETVAL_STRING(db_info, 1); | ||||
| +#endif
 | ||||
|  	free(db_info); | ||||
|  } | ||||
|  /* }}} */ | ||||
|   | ||||
|  /* {{{ */ | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
|  #define GEOIPDEF(php_func, c_func, db_type) \ | ||||
|  	PHP_FUNCTION(php_func) \ | ||||
|  	{ \ | ||||
| @@ -358,6 +391,34 @@
 | ||||
|  		GeoIP * gi; \ | ||||
|  		char * hostname = NULL; \ | ||||
|  		const char * return_code; \ | ||||
| +		size_t arglen; \
 | ||||
| +		\
 | ||||
| +		if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { \
 | ||||
| +			return; \
 | ||||
| +		} \
 | ||||
| +		\
 | ||||
| +		if (GeoIP_db_avail(db_type)) { \
 | ||||
| +			gi = GeoIP_open_type(db_type, GEOIP_STANDARD); \
 | ||||
| +		} else { \
 | ||||
| +			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Required database not available at %s.", GeoIPDBFileName[db_type]); \
 | ||||
| +			return; \
 | ||||
| +		} \
 | ||||
| +		\
 | ||||
| +		return_code = c_func(gi, hostname); \
 | ||||
| +		GeoIP_delete(gi); \
 | ||||
| +		if (return_code == NULL) { \
 | ||||
| +			RETURN_FALSE; \
 | ||||
| +		} \
 | ||||
| +		RETURN_STRING((char*)return_code); \
 | ||||
| +		\
 | ||||
| +	}
 | ||||
| +#else
 | ||||
| +#define GEOIPDEF(php_func, c_func, db_type) \
 | ||||
| +	PHP_FUNCTION(php_func) \
 | ||||
| +	{ \
 | ||||
| +		GeoIP * gi; \
 | ||||
| +		char * hostname = NULL; \
 | ||||
| +		const char * return_code; \
 | ||||
|  		int arglen; \ | ||||
|  		\ | ||||
|  		if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { \ | ||||
| @@ -379,6 +440,7 @@
 | ||||
|  		RETURN_STRING((char*)return_code, 1); \ | ||||
|  		\ | ||||
|  	} | ||||
| +#endif
 | ||||
|  #include "geoip.def" | ||||
|  #undef GEOIPDEF | ||||
|  /* }}} */ | ||||
| @@ -390,7 +452,11 @@
 | ||||
|  	GeoIP * gi; | ||||
|  	char * hostname = NULL; | ||||
|  	int id; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t arglen;
 | ||||
| +#else
 | ||||
|  	int arglen; | ||||
| +#endif
 | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { | ||||
|  		return; | ||||
| @@ -408,7 +474,11 @@
 | ||||
|  	if (id == 0) { | ||||
|  		RETURN_FALSE; | ||||
|  	} | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	RETURN_STRING((char *)GeoIP_country_continent[id]);
 | ||||
| +#else
 | ||||
|  	RETURN_STRING((char *)GeoIP_country_continent[id], 1); | ||||
| +#endif
 | ||||
|  } | ||||
|  /* }}} */ | ||||
|   | ||||
| @@ -419,7 +489,11 @@
 | ||||
|  	GeoIP * gi; | ||||
|  	char * hostname = NULL; | ||||
|  	char * org; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t arglen;
 | ||||
| +#else
 | ||||
|  	int arglen; | ||||
| +#endif
 | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { | ||||
|  		return; | ||||
| @@ -437,7 +511,11 @@
 | ||||
|  	if (org == NULL) { | ||||
|  		RETURN_FALSE; | ||||
|  	} | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	RETVAL_STRING(org);
 | ||||
| +#else
 | ||||
|  	RETVAL_STRING(org, 1); | ||||
| +#endif
 | ||||
|  	free(org); | ||||
|  } | ||||
|  /* }}} */ | ||||
| @@ -449,7 +527,11 @@
 | ||||
|  	GeoIP * gi; | ||||
|  	char * hostname = NULL; | ||||
|  	char * org; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t arglen;
 | ||||
| +#else
 | ||||
|  	int arglen; | ||||
| +#endif
 | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { | ||||
|  		return; | ||||
| @@ -467,7 +549,11 @@
 | ||||
|  	if (org == NULL) { | ||||
|  		RETURN_FALSE; | ||||
|  	} | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	RETVAL_STRING(org);
 | ||||
| +#else
 | ||||
|  	RETVAL_STRING(org, 1); | ||||
| +#endif
 | ||||
|  	free(org); | ||||
|  } | ||||
|  /* }}} */ | ||||
| @@ -479,7 +565,11 @@
 | ||||
|  	GeoIP * gi; | ||||
|  	char * hostname = NULL; | ||||
|  	char * org; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t arglen;
 | ||||
| +#else
 | ||||
|  	int arglen; | ||||
| +#endif
 | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { | ||||
|  		return; | ||||
| @@ -497,7 +587,11 @@
 | ||||
|  	if (org == NULL) { | ||||
|  		RETURN_FALSE; | ||||
|  	} | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	RETVAL_STRING(org);
 | ||||
| +#else
 | ||||
|  	RETVAL_STRING(org, 1); | ||||
| +#endif
 | ||||
|  	free(org); | ||||
|  } | ||||
|  /* }}} */ | ||||
| @@ -510,7 +604,11 @@
 | ||||
|  	GeoIP * gi; | ||||
|  	char * hostname = NULL; | ||||
|  	char * org; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t arglen;
 | ||||
| +#else
 | ||||
|  	int arglen; | ||||
| +#endif
 | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { | ||||
|  		return; | ||||
| @@ -528,7 +626,11 @@
 | ||||
|  	if (org == NULL) { | ||||
|  		RETURN_FALSE; | ||||
|  	} | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	RETVAL_STRING(org);
 | ||||
| +#else
 | ||||
|  	RETVAL_STRING(org, 1); | ||||
| +#endif
 | ||||
|  	free(org); | ||||
|  } | ||||
|  /* }}} */ | ||||
| @@ -540,7 +642,11 @@
 | ||||
|  { | ||||
|  	GeoIP * gi; | ||||
|  	char * hostname = NULL; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t arglen;
 | ||||
| +#else
 | ||||
|  	int arglen; | ||||
| +#endif
 | ||||
|  	GeoIPRecord * gir; | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { | ||||
| @@ -566,9 +672,20 @@
 | ||||
|  	} | ||||
|  	 | ||||
|  	array_init(return_value); | ||||
| -#if LIBGEOIP_VERSION >= 1004003
 | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +# if LIBGEOIP_VERSION >= 1004003
 | ||||
| +	add_assoc_string(return_value, "continent_code", (gir->continent_code == NULL) ? "" : gir->continent_code);
 | ||||
| +# endif
 | ||||
| +	add_assoc_string(return_value, "country_code", (gir->country_code == NULL) ? "" : gir->country_code);
 | ||||
| +	add_assoc_string(return_value, "country_code3", (gir->country_code3 == NULL) ? "" : gir->country_code3);
 | ||||
| +	add_assoc_string(return_value, "country_name", (gir->country_name == NULL) ? "" : gir->country_name);
 | ||||
| +	add_assoc_string(return_value, "region", (gir->region == NULL) ? "" : gir->region);
 | ||||
| +	add_assoc_string(return_value, "city", (gir->city == NULL) ? "" : gir->city);
 | ||||
| +	add_assoc_string(return_value, "postal_code", (gir->postal_code == NULL) ? "" : gir->postal_code);
 | ||||
| +#else
 | ||||
| +# if LIBGEOIP_VERSION >= 1004003
 | ||||
|  	add_assoc_string(return_value, "continent_code", (gir->continent_code == NULL) ? "" : gir->continent_code, 1); | ||||
| -#endif
 | ||||
| +# endif
 | ||||
|  	add_assoc_string(return_value, "country_code", (gir->country_code == NULL) ? "" : gir->country_code, 1); | ||||
|  	add_assoc_string(return_value, "country_code3", (gir->country_code3 == NULL) ? "" : gir->country_code3, 1); | ||||
|  	add_assoc_string(return_value, "country_name", (gir->country_name == NULL) ? "" : gir->country_name, 1); | ||||
| @@ -575,6 +692,7 @@
 | ||||
|  	add_assoc_string(return_value, "region", (gir->region == NULL) ? "" : gir->region, 1); | ||||
|  	add_assoc_string(return_value, "city", (gir->city == NULL) ? "" : gir->city, 1); | ||||
|  	add_assoc_string(return_value, "postal_code", (gir->postal_code == NULL) ? "" : gir->postal_code, 1); | ||||
| +#endif
 | ||||
|  	add_assoc_double(return_value, "latitude", gir->latitude); | ||||
|  	add_assoc_double(return_value, "longitude", gir->longitude); | ||||
|  #if LIBGEOIP_VERSION >= 1004005 | ||||
| @@ -594,7 +712,11 @@
 | ||||
|  { | ||||
|  	GeoIP * gi; | ||||
|  	char * hostname = NULL; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t arglen;
 | ||||
| +#else
 | ||||
|  	int arglen; | ||||
| +#endif
 | ||||
|  	int netspeed; | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { | ||||
| @@ -620,7 +742,11 @@
 | ||||
|  { | ||||
|  	GeoIP * gi; | ||||
|  	char * hostname = NULL; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t arglen;
 | ||||
| +#else
 | ||||
|  	int arglen; | ||||
| +#endif
 | ||||
|  	GeoIPRegion * region; | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { | ||||
| @@ -646,9 +772,14 @@
 | ||||
|  	} | ||||
|   | ||||
|  	array_init(return_value); | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	add_assoc_string(return_value, "country_code", region->country_code);
 | ||||
| +	add_assoc_string(return_value, "region", region->region);
 | ||||
| +#else
 | ||||
|  	add_assoc_string(return_value, "country_code", region->country_code, 1); | ||||
|  	add_assoc_string(return_value, "region", region->region, 1); | ||||
| -	
 | ||||
| +#endif
 | ||||
| +
 | ||||
|  	GeoIPRegion_delete(region); | ||||
|  } | ||||
|  /* }}} */ | ||||
| @@ -660,7 +791,11 @@
 | ||||
|  	GeoIP * gi; | ||||
|  	char * hostname = NULL; | ||||
|  	char * isp; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t arglen;
 | ||||
| +#else
 | ||||
|  	int arglen; | ||||
| +#endif
 | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { | ||||
|  		return; | ||||
| @@ -678,7 +813,11 @@
 | ||||
|  	if (isp == NULL) { | ||||
|  		RETURN_FALSE; | ||||
|  	} | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	RETVAL_STRING(isp);
 | ||||
| +#else
 | ||||
|  	RETVAL_STRING(isp, 1); | ||||
| +#endif
 | ||||
|  	free(isp); | ||||
|  } | ||||
|   | ||||
| @@ -690,7 +829,11 @@
 | ||||
|  	char * country_code = NULL; | ||||
|  	char * region_code = NULL; | ||||
|  	const char * region_name; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t countrylen, regionlen;
 | ||||
| +#else
 | ||||
|  	int countrylen, regionlen; | ||||
| +#endif
 | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &country_code, &countrylen, ®ion_code, ®ionlen) == FAILURE) { | ||||
|  		return; | ||||
| @@ -705,7 +848,11 @@
 | ||||
|  	if (region_name == NULL) { | ||||
|  		RETURN_FALSE; | ||||
|  	} | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	RETURN_STRING((char*)region_name);
 | ||||
| +#else
 | ||||
|  	RETURN_STRING((char*)region_name, 1); | ||||
| +#endif
 | ||||
|  } | ||||
|  /* }}} */ | ||||
|  #endif | ||||
| @@ -718,7 +865,11 @@
 | ||||
|  	char * country = NULL; | ||||
|  	char * region = NULL; | ||||
|  	const char * timezone; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t countrylen, arg2len;
 | ||||
| +#else
 | ||||
|  	int countrylen, arg2len; | ||||
| +#endif
 | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &country, &countrylen, ®ion, &arg2len) == FAILURE) { | ||||
|  		return; | ||||
| @@ -733,7 +884,11 @@
 | ||||
|  	if (timezone == NULL) { | ||||
|  		RETURN_FALSE; | ||||
|  	} | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	RETURN_STRING((char*)timezone);
 | ||||
| +#else
 | ||||
|  	RETURN_STRING((char*)timezone, 1); | ||||
| +#endif
 | ||||
|  } | ||||
|  /* }}} */ | ||||
|  #endif | ||||
| @@ -744,7 +899,11 @@
 | ||||
|  PHP_FUNCTION(geoip_setup_custom_directory) | ||||
|  { | ||||
|  	char * dir = NULL; | ||||
| +#if PHP_MAJOR_VERSION >= 7
 | ||||
| +	size_t dirlen;
 | ||||
| +#else
 | ||||
|  	int dirlen; | ||||
| +#endif
 | ||||
|   | ||||
|  	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &dir, &dirlen) == FAILURE) { | ||||
|  		return; | ||||
							
								
								
									
										8
									
								
								dev-php/pecl-geoip/metadata.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								dev-php/pecl-geoip/metadata.xml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> | ||||
| <pkgmetadata> | ||||
| 	<maintainer> | ||||
| 		<email>manuel@fritteli.ch</email> | ||||
| 		<name>Manuel Friedli</name> | ||||
| 	</maintainer> | ||||
| </pkgmetadata> | ||||
							
								
								
									
										43
									
								
								dev-php/pecl-geoip/pecl-geoip-1.1.0.9999.ebuild
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								dev-php/pecl-geoip/pecl-geoip-1.1.0.9999.ebuild
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,43 @@ | |||
| # Copyright 1999-2016 Gentoo Foundation | ||||
| # Distributed under the terms of the GNU General Public License v2 | ||||
| # $Id$ | ||||
| 
 | ||||
| EAPI="5" | ||||
| 
 | ||||
| PHP_EXT_NAME="geoip" | ||||
| PHP_EXT_INI="yes" | ||||
| PHP_EXT_ZENDEXT="no" | ||||
| DOCS="README ChangeLog" | ||||
| MY_PV="1.1.0" | ||||
| 
 | ||||
| USE_PHP="php7-0" | ||||
| 
 | ||||
| inherit eutils php-ext-pecl-r2 | ||||
| 
 | ||||
| KEYWORDS="~amd64 ~x86" | ||||
| 
 | ||||
| DESCRIPTION="PHP extension to map IP address to geographic places" | ||||
| LICENSE="PHP-3" | ||||
| SLOT="0" | ||||
| IUSE="" | ||||
| 
 | ||||
| DEPEND=">=dev-libs/geoip-1.4.0" | ||||
| RDEPEND="${DEPEND}" | ||||
| 
 | ||||
| PATCHES=( | ||||
| 	"${FILESDIR}/${P}-patch-to-svn-r337409.patch" | ||||
| ) | ||||
| 
 | ||||
| # apply patches in unpack phase, or else the php7.0 dir won't get patched | ||||
| src_prepare() { | ||||
| 	local slot | ||||
| 	local p | ||||
| 	for slot in $(php_get_slots) ; do | ||||
| 		cd "${WORKDIR}/${slot}" | ||||
| 		for p in "${PATCHES[@]}" ; do | ||||
| 			epatch "${p}" | ||||
| 		done | ||||
| 	done | ||||
| 
 | ||||
| 	php-ext-source-r2_src_prepare | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue