summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-09-25 09:07:44 +0200
committerRemi Collet <remi@remirepo.net>2020-09-25 09:07:44 +0200
commit13fdad5a9730d2f1e1025ac08efe7e3e638e3339 (patch)
tree77b8a4ad56482a47028aeb1e62bb6208fcd83e04
parent9b4eb742b5ed52f7257329fd37946f69f64dc919 (diff)
add patches for library version 8.1 and for PHP 8 from
https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/8 https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/9 https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/10 https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/11
-rw-r--r--10.patch41
-rw-r--r--11.patch37
-rw-r--r--8.patch390
-rw-r--r--9.patch109
-rw-r--r--PHPINFO6
-rw-r--r--REFLECTION108
-rw-r--r--php-pecl-ip2location.spec39
7 files changed, 715 insertions, 15 deletions
diff --git a/10.patch b/10.patch
new file mode 100644
index 0000000..b8ade4b
--- /dev/null
+++ b/10.patch
@@ -0,0 +1,41 @@
+From c788be10e9bd9979b9f8ae0d649b26f6b1cce140 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 24 Sep 2020 11:01:28 +0200
+Subject: [PATCH] display library version in MINFO
+
+---
+ ip2location.c | 19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/ip2location.c b/ip2location.c
+index 7996b57..848bb36 100644
+--- a/ip2location.c
++++ b/ip2location.c
+@@ -119,9 +119,26 @@ PHP_MSHUTDOWN_FUNCTION(ip2location)
+ * */
+ PHP_MINFO_FUNCTION(ip2location)
+ {
++ char buf[32];
++ unsigned long ver;
++
+ php_info_print_table_start();
+ php_info_print_table_header(2, "ip2location support", "enabled");
+- php_info_print_table_row(2, "version", PHP_IP2LOCATION_VERSION);
++ php_info_print_table_row(2, "extension version", PHP_IP2LOCATION_VERSION);
++#if API_VERSION_NUMERIC >= 80100
++ ver = IP2Location_api_version_number();
++#else
++ ver = IP2Location_api_version_num();
++#endif
++ snprintf(buf, sizeof(buf), "%d.%d.%d", API_VERSION_MAJOR, API_VERSION_MINOR, API_VERSION_RELEASE);
++ if (API_VERSION_NUMERIC == ver) {
++ php_info_print_table_row(2, "library version", buf);
++ } else {
++ /* display both headers/runtime versions when differ */
++ php_info_print_table_row(2, "library headers version", buf);
++ snprintf(buf, sizeof(buf), "%lu.%lu.%lu", ver / 10000, (ver / 100) % 100, ver % 100);
++ php_info_print_table_row(2, "library runtime version", buf);
++ }
+ php_info_print_table_end();
+ }
+ /* }}} */
diff --git a/11.patch b/11.patch
new file mode 100644
index 0000000..be346f2
--- /dev/null
+++ b/11.patch
@@ -0,0 +1,37 @@
+From e73c4c546dc7845cd161e51ffe339acb5421c39b Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 24 Sep 2020 11:37:49 +0200
+Subject: [PATCH] remove remaining hardcoded /lib
+
+---
+ config.m4 | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/config.m4 b/config.m4
+index 5abb4fa..b8041bc 100644
+--- a/config.m4
++++ b/config.m4
+@@ -9,7 +9,7 @@ dnl Make sure that the comment is aligned:
+ if test "$PHP_IP2LOCATION" != "no"; then
+
+ # --with-ip2location -> check with-path
+- SEARCH_PATH="/usr/local /usr /opt/local /lib"
++ SEARCH_PATH="/usr/local /usr /opt/local"
+ SEARCH_FOR="/include/IP2Location.h"
+ if test -r $PHP_IP2LOCATION/$SEARCH_FOR; then
+ IP2LOCATION_DIR=$PHP_IP2LOCATION
+@@ -43,12 +43,12 @@ if test "$PHP_IP2LOCATION" != "no"; then
+
+ PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOLNEW,
+ [
+- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $IP2LOCATION_DIR/lib, IP2LOCATION_SHARED_LIBADD)
++ PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $IP2LOCATION_DIR/$PHP_LIBDIR, IP2LOCATION_SHARED_LIBADD)
+ AC_DEFINE(HAVE_IPLOCATIONLIB,1,[ ])
+ ],[
+ PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOLOLD,
+ [
+- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $IP2LOCATION_DIR/lib, IP2LOCATION_SHARED_LIBADD)
++ PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $IP2LOCATION_DIR/$PHP_LIBDIR, IP2LOCATION_SHARED_LIBADD)
+ AC_DEFINE(HAVE_IPLOCATIONLIB,1,[ ])
+ ],[
+ AC_MSG_ERROR([wrong ip2location, lib version >= 6.x.x is required or library not found])
diff --git a/8.patch b/8.patch
new file mode 100644
index 0000000..94126f7
--- /dev/null
+++ b/8.patch
@@ -0,0 +1,390 @@
+From 570306a94ee8caa1af9c817c5f991cbfee9003d3 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 24 Sep 2020 09:34:59 +0200
+Subject: [PATCH] adapt for library version 8.1.0
+
+---
+ config.m4 | 17 ++++--
+ ip2location.c | 146 +++++++++++++++++++++++++++++++++++++++-----------
+ 2 files changed, 128 insertions(+), 35 deletions(-)
+
+diff --git a/config.m4 b/config.m4
+index 7c3ae1d..5abb4fa 100644
+--- a/config.m4
++++ b/config.m4
+@@ -38,16 +38,25 @@ if test "$PHP_IP2LOCATION" != "no"; then
+
+ # --with-ip2location -> check for lib and symbol presence
+ LIBNAME=IP2Location # you may want to change this
+- LIBSYMBOL=IP2Location_open_mem # you most likely want to change this
++ LIBSYMBOLOLD=IP2Location_open_mem
++ LIBSYMBOLNEW=IP2Location_set_lookup_mode
+
+- PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
++ PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOLNEW,
+ [
+ PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $IP2LOCATION_DIR/lib, IP2LOCATION_SHARED_LIBADD)
+ AC_DEFINE(HAVE_IPLOCATIONLIB,1,[ ])
+ ],[
+- AC_MSG_ERROR([wrong ip2location, lib version >= 6.x.x is required or library not found])
++ PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOLOLD,
++ [
++ PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $IP2LOCATION_DIR/lib, IP2LOCATION_SHARED_LIBADD)
++ AC_DEFINE(HAVE_IPLOCATIONLIB,1,[ ])
++ ],[
++ AC_MSG_ERROR([wrong ip2location, lib version >= 6.x.x is required or library not found])
++ ],[
++ -L$IP2LOCATION_DIR/$PHP_LIBDIR
++ ])
+ ],[
+- -L$IP2LOCATION_DIR/$PHP_LIBDIR
++ -L$IP2LOCATION_DIR/$PHP_LIBDIR
+ ])
+
+ PHP_SUBST(IP2LOCATION_SHARED_LIBADD)
+diff --git a/ip2location.c b/ip2location.c
+index e415e68..7996b57 100644
+--- a/ip2location.c
++++ b/ip2location.c
+@@ -158,7 +158,11 @@ PHP_FUNCTION(ip2location_open_mem)
+ }
+ /*Shared memory method is not supported*/
+ if( method == IP2LOCATION_FILE_IO || method == IP2LOCATION_CACHE_MEMORY || method == IP2LOCATION_SHARED_MEMORY ){
++#if API_VERSION_NUMERIC >= 80100
++ if(IP2Location_set_lookup_mode(IP2LOCATION_G(ip2location_ptr), method) == -1){
++#else
+ if(IP2Location_open_mem(IP2LOCATION_G(ip2location_ptr), method) == -1){
++#endif
+ RETURN_FALSE;
+ }
+ else{
+@@ -351,7 +355,7 @@ PHP_FUNCTION(ip2location_get_domain)
+ * Returns ip address's zipcode information */
+ PHP_FUNCTION(ip2location_get_zipcode)
+ {
+- char *ip_address;
++ char *ip_address, *ret;
+ size_t ip_len;
+ IP2LocationRecord *record = NULL;
+
+@@ -361,10 +365,15 @@ PHP_FUNCTION(ip2location_get_zipcode)
+ return;
+ }
+ record = IP2Location_get_zipcode(IP2LOCATION_G(ip2location_ptr), ip_address);
++#if API_VERSION_NUMERIC >= 80100
++ ret = record->zip_code;
++#else
++ ret = record->zipcode;
++#endif
+ #if PHP_MAJOR_VERSION >= 7
+- RETVAL_STRING(record->zipcode);
++ RETVAL_STRING(ret);
+ #else
+- RETVAL_STRING(record->zipcode, 1);
++ RETVAL_STRING(ret, 1);
+ #endif
+ IP2Location_free_record(record);
+ }
+@@ -374,7 +383,7 @@ PHP_FUNCTION(ip2location_get_zipcode)
+ * Returns ip address's timezone information */
+ PHP_FUNCTION(ip2location_get_timezone)
+ {
+- char *ip_address;
++ char *ip_address, *ret;
+ size_t ip_len;
+ IP2LocationRecord *record = NULL;
+
+@@ -384,20 +393,31 @@ PHP_FUNCTION(ip2location_get_timezone)
+ return;
+ }
+ record = IP2Location_get_timezone(IP2LOCATION_G(ip2location_ptr), ip_address);
++#if API_VERSION_NUMERIC >= 80100
++ ret = record->time_zone;
++#else
++ ret = record->timezone;
++#endif
+ #if PHP_MAJOR_VERSION >= 7
+- RETVAL_STRING(record->timezone);
++ RETVAL_STRING(ret);
+ #else
+- RETVAL_STRING(record->timezone, 1);
++ RETVAL_STRING(ret, 1);
+ #endif
+ IP2Location_free_record(record);
+ }
+ /* }}} */
+
++
++#if API_VERSION_NUMERIC >= 80100
++/* see https://github.com/chrislim2888/IP2Location-C-Library/issues/37 */
++IP2LocationRecord *IP2Location_get_netspeed(IP2Location *handler, char *ip);
++#endif
++
+ /* {{{ ip2location_get_netspeed("ip_address")
+ * Returns ip address's netspeed information */
+ PHP_FUNCTION(ip2location_get_netspeed)
+ {
+- char *ip_address;
++ char *ip_address, *ret;
+ size_t ip_len;
+ IP2LocationRecord *record = NULL;
+
+@@ -406,11 +426,17 @@ PHP_FUNCTION(ip2location_get_netspeed)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &ip_address, &ip_len) == FAILURE) {
+ return;
+ }
++
+ record = IP2Location_get_netspeed(IP2LOCATION_G(ip2location_ptr), ip_address);
++#if API_VERSION_NUMERIC >= 80100
++ ret = record->net_speed;
++#else
++ ret = record->netspeed;
++#endif
+ #if PHP_MAJOR_VERSION >= 7
+- RETVAL_STRING(record->netspeed);
++ RETVAL_STRING(ret);
+ #else
+- RETVAL_STRING(record->netspeed, 1);
++ RETVAL_STRING(ret, 1);
+ #endif
+ IP2Location_free_record(record);
+ }
+@@ -420,7 +446,7 @@ PHP_FUNCTION(ip2location_get_netspeed)
+ * Returns ip address's iddcode information */
+ PHP_FUNCTION(ip2location_get_iddcode)
+ {
+- char *ip_address;
++ char *ip_address, *ret;
+ size_t ip_len;
+ IP2LocationRecord *record = NULL;
+
+@@ -430,10 +456,15 @@ PHP_FUNCTION(ip2location_get_iddcode)
+ return;
+ }
+ record = IP2Location_get_iddcode(IP2LOCATION_G(ip2location_ptr), ip_address);
++#if API_VERSION_NUMERIC >= 80100
++ ret = record->idd_code;
++#else
++ ret = record->iddcode;
++#endif
+ #if PHP_MAJOR_VERSION >= 7
+- RETVAL_STRING(record->iddcode);
++ RETVAL_STRING(ret);
+ #else
+- RETVAL_STRING(record->iddcode, 1);
++ RETVAL_STRING(ret, 1);
+ #endif
+ IP2Location_free_record(record);
+ }
+@@ -443,7 +474,7 @@ PHP_FUNCTION(ip2location_get_iddcode)
+ * Returns ip address's areacode information */
+ PHP_FUNCTION(ip2location_get_areacode)
+ {
+- char *ip_address;
++ char *ip_address, *ret;
+ size_t ip_len;
+ IP2LocationRecord *record = NULL;
+
+@@ -453,10 +484,15 @@ PHP_FUNCTION(ip2location_get_areacode)
+ return;
+ }
+ record = IP2Location_get_areacode(IP2LOCATION_G(ip2location_ptr), ip_address);
++#if API_VERSION_NUMERIC >= 80100
++ ret = record->area_code;
++#else
++ ret = record->areacode;
++#endif
+ #if PHP_MAJOR_VERSION >= 7
+- RETVAL_STRING(record->areacode);
++ RETVAL_STRING(ret);
+ #else
+- RETVAL_STRING(record->areacode, 1);
++ RETVAL_STRING(ret, 1);
+ #endif
+ IP2Location_free_record(record);
+ }
+@@ -466,7 +502,7 @@ PHP_FUNCTION(ip2location_get_areacode)
+ * Returns ip address's weatherstationcode information */
+ PHP_FUNCTION(ip2location_get_weatherstationcode)
+ {
+- char *ip_address;
++ char *ip_address, *ret;
+ size_t ip_len;
+ IP2LocationRecord *record = NULL;
+
+@@ -476,10 +512,15 @@ PHP_FUNCTION(ip2location_get_weatherstationcode)
+ return;
+ }
+ record = IP2Location_get_weatherstationcode(IP2LOCATION_G(ip2location_ptr), ip_address);
++#if API_VERSION_NUMERIC >= 80100
++ ret = record->weather_station_code;
++#else
++ ret = record->weatherstationcode;
++#endif
+ #if PHP_MAJOR_VERSION >= 7
+- RETVAL_STRING(record->weatherstationcode);
++ RETVAL_STRING(ret);
+ #else
+- RETVAL_STRING(record->weatherstationcode, 1);
++ RETVAL_STRING(ret, 1);
+ #endif
+ IP2Location_free_record(record);
+ }
+@@ -489,7 +530,7 @@ PHP_FUNCTION(ip2location_get_weatherstationcode)
+ * Returns ip address's weatherstationname information */
+ PHP_FUNCTION(ip2location_get_weatherstationname)
+ {
+- char *ip_address;
++ char *ip_address, *ret;
+ size_t ip_len;
+ IP2LocationRecord *record = NULL;
+
+@@ -499,10 +540,15 @@ PHP_FUNCTION(ip2location_get_weatherstationname)
+ return;
+ }
+ record = IP2Location_get_weatherstationname(IP2LOCATION_G(ip2location_ptr), ip_address);
++#if API_VERSION_NUMERIC >= 80100
++ ret = record->weather_station_name;
++#else
++ ret = record->weatherstationname;
++#endif
+ #if PHP_MAJOR_VERSION >= 7
+- RETVAL_STRING(record->weatherstationname);
++ RETVAL_STRING(ret);
+ #else
+- RETVAL_STRING(record->weatherstationname, 1);
++ RETVAL_STRING(ret, 1);
+ #endif
+ IP2Location_free_record(record);
+ }
+@@ -558,7 +604,7 @@ PHP_FUNCTION(ip2location_get_mnc)
+ * Returns ip address's mobilebrand information */
+ PHP_FUNCTION(ip2location_get_mobilebrand)
+ {
+- char *ip_address;
++ char *ip_address, *ret;
+ size_t ip_len;
+ IP2LocationRecord *record = NULL;
+
+@@ -568,10 +614,15 @@ PHP_FUNCTION(ip2location_get_mobilebrand)
+ return;
+ }
+ record = IP2Location_get_mobilebrand(IP2LOCATION_G(ip2location_ptr), ip_address);
++#if API_VERSION_NUMERIC >= 80100
++ ret = record->mobile_brand;
++#else
++ ret = record->mobilebrand;
++#endif
+ #if PHP_MAJOR_VERSION >= 7
+- RETVAL_STRING(record->mobilebrand);
++ RETVAL_STRING(ret);
+ #else
+- RETVAL_STRING(record->mobilebrand, 1);
++ RETVAL_STRING(ret, 1);
+ #endif
+ IP2Location_free_record(record);
+ }
+@@ -600,7 +651,7 @@ PHP_FUNCTION(ip2location_get_elevation)
+ * Returns ip address's internet connection usagetype information */
+ PHP_FUNCTION(ip2location_get_usagetype)
+ {
+- char *ip_address;
++ char *ip_address, *ret;
+ size_t ip_len;
+ IP2LocationRecord *record = NULL;
+
+@@ -610,10 +661,15 @@ PHP_FUNCTION(ip2location_get_usagetype)
+ return;
+ }
+ record = IP2Location_get_usagetype(IP2LOCATION_G(ip2location_ptr), ip_address);
++#if API_VERSION_NUMERIC >= 80100
++ ret = record->usage_type;
++#else
++ ret = record->usagetype;
++#endif
+ #if PHP_MAJOR_VERSION >= 7
+- RETVAL_STRING(record->usagetype);
++ RETVAL_STRING(ret);
+ #else
+- RETVAL_STRING(record->usagetype, 1);
++ RETVAL_STRING(ret, 1);
+ #endif
+ IP2Location_free_record(record);
+ }
+@@ -641,6 +697,17 @@ PHP_FUNCTION(ip2location_get_all)
+ add_assoc_string(return_value, "city",record->city);
+ add_assoc_string(return_value, "isp",record->isp);
+ add_assoc_string(return_value, "domain",record->domain);
++#if API_VERSION_NUMERIC >= 80100
++ add_assoc_string(return_value, "zipcode",record->zip_code);
++ add_assoc_string(return_value, "timezone",record->time_zone);
++ add_assoc_string(return_value, "netspeed",record->net_speed);
++ add_assoc_string(return_value, "iddcode",record->idd_code);
++ add_assoc_string(return_value, "areacode",record->area_code);
++ add_assoc_string(return_value, "weatherstationcode",record->weather_station_code);
++ add_assoc_string(return_value, "weatherstationname",record->weather_station_name);
++ add_assoc_string(return_value, "mobilebrand",record->mobile_brand);
++ add_assoc_string(return_value, "usagetype",record->usage_type);
++#else
+ add_assoc_string(return_value, "zipcode",record->zipcode);
+ add_assoc_string(return_value, "timezone",record->timezone);
+ add_assoc_string(return_value, "netspeed",record->netspeed);
+@@ -648,10 +715,11 @@ PHP_FUNCTION(ip2location_get_all)
+ add_assoc_string(return_value, "areacode",record->areacode);
+ add_assoc_string(return_value, "weatherstationcode",record->weatherstationcode);
+ add_assoc_string(return_value, "weatherstationname",record->weatherstationname);
+- add_assoc_string(return_value, "mcc",record->mcc);
+- add_assoc_string(return_value, "mnc",record->mnc);
+ add_assoc_string(return_value, "mobilebrand",record->mobilebrand);
+ add_assoc_string(return_value, "usagetype",record->usagetype);
++#endif
++ add_assoc_string(return_value, "mcc",record->mcc);
++ add_assoc_string(return_value, "mnc",record->mnc);
+ #else
+ add_assoc_string(return_value, "country_short", record->country_short, 1);
+ add_assoc_string(return_value, "country_long", record->country_long, 1);
+@@ -659,6 +727,17 @@ PHP_FUNCTION(ip2location_get_all)
+ add_assoc_string(return_value, "city",record->city, 1);
+ add_assoc_string(return_value, "isp",record->isp, 1);
+ add_assoc_string(return_value, "domain",record->domain, 1);
++#if API_VERSION_NUMERIC >= 80100
++ add_assoc_string(return_value, "zipcode",record->zip_code, 1);
++ add_assoc_string(return_value, "timezone",record->time_zone, 1);
++ add_assoc_string(return_value, "netspeed",record->net_speed, 1);
++ add_assoc_string(return_value, "iddcode",record->idd_code, 1);
++ add_assoc_string(return_value, "areacode",record->area_code, 1);
++ add_assoc_string(return_value, "weatherstationcode",record->weather_station_code, 1);
++ add_assoc_string(return_value, "weatherstationname",record->weather_station_name, 1);
++ add_assoc_string(return_value, "mobilebrand",record->mobile_brand, 1);
++ add_assoc_string(return_value, "usagetype",record->usage_type, 1);
++#else
+ add_assoc_string(return_value, "zipcode",record->zipcode, 1);
+ add_assoc_string(return_value, "timezone",record->timezone, 1);
+ add_assoc_string(return_value, "netspeed",record->netspeed, 1);
+@@ -666,11 +745,12 @@ PHP_FUNCTION(ip2location_get_all)
+ add_assoc_string(return_value, "areacode",record->areacode, 1);
+ add_assoc_string(return_value, "weatherstationcode",record->weatherstationcode, 1);
+ add_assoc_string(return_value, "weatherstationname",record->weatherstationname, 1);
+- add_assoc_string(return_value, "mcc",record->mcc, 1);
+- add_assoc_string(return_value, "mnc",record->mnc, 1);
+ add_assoc_string(return_value, "mobilebrand",record->mobilebrand, 1);
+ add_assoc_string(return_value, "usagetype",record->usagetype, 1);
+ #endif
++ add_assoc_string(return_value, "mcc",record->mcc, 1);
++ add_assoc_string(return_value, "mnc",record->mnc, 1);
++#endif
+
+ add_assoc_double(return_value, "latitude",record->latitude );
+ add_assoc_double(return_value, "longitude",record->longitude );
+@@ -701,7 +781,11 @@ PHP_FUNCTION(ip2location_delete_shm)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") != SUCCESS) {
+ return;
+ }
++#if API_VERSION_NUMERIC >= 80100
++ IP2Location_clear_memory();
++#else
+ IP2Location_delete_shm();
++#endif
+ }
+ /* }}} */
+
diff --git a/9.patch b/9.patch
new file mode 100644
index 0000000..375cf97
--- /dev/null
+++ b/9.patch
@@ -0,0 +1,109 @@
+From 47b8ff06fba74c5fbe57b06c60b898d4b120139c Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 24 Sep 2020 10:36:13 +0200
+Subject: [PATCH] add all arginfo, and fix PHP 8 compatibility
+
+---
+ ip2location.c | 76 +++++++++++++++++++++++++++++++++------------------
+ 1 file changed, 50 insertions(+), 26 deletions(-)
+
+diff --git a/ip2location.c b/ip2location.c
+index 7996b57..4d91bd6 100644
+--- a/ip2location.c
++++ b/ip2location.c
+@@ -26,37 +26,61 @@
+
+ #include "php_ip2location.h"
+
++/* For PHP 8 */
++#ifndef TSRMLS_CC
++#define TSRMLS_CC
++#endif
++
+ ZEND_DECLARE_MODULE_GLOBALS(ip2location)
+
+ #define IP2LOCATION_RECORD 0
+
++ZEND_BEGIN_ARG_INFO_EX(ip2location_open, 0, 0, 1)
++ ZEND_ARG_INFO(0, file_path)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(ip2location_open_mem, 0, 0, 1)
++ ZEND_ARG_INFO(0, method)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(ip2location_ip_address, 0, 0, 1)
++ ZEND_ARG_INFO(0, ip_address)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(ip2location_void, 0, 0, 0)
++ZEND_END_ARG_INFO()
++
+ static zend_function_entry ip2location_functions_entry[] = {
+- PHP_FE(ip2location_open, NULL)
+- PHP_FE(ip2location_open_mem, NULL)
+- PHP_FE(ip2location_get_country_short, NULL)
+- PHP_FE(ip2location_get_country_long, NULL)
+- PHP_FE(ip2location_get_region, NULL)
+- PHP_FE(ip2location_get_city, NULL)
+- PHP_FE(ip2location_get_isp, NULL)
+- PHP_FE(ip2location_get_latitude, NULL)
+- PHP_FE(ip2location_get_longitude, NULL)
+- PHP_FE(ip2location_get_domain, NULL)
+- PHP_FE(ip2location_get_zipcode, NULL)
+- PHP_FE(ip2location_get_timezone, NULL)
+- PHP_FE(ip2location_get_netspeed, NULL)
+- PHP_FE(ip2location_get_iddcode, NULL)
+- PHP_FE(ip2location_get_areacode, NULL)
+- PHP_FE(ip2location_get_weatherstationcode, NULL)
+- PHP_FE(ip2location_get_weatherstationname, NULL)
+- PHP_FE(ip2location_get_mcc, NULL)
+- PHP_FE(ip2location_get_mnc, NULL)
+- PHP_FE(ip2location_get_mobilebrand, NULL)
+- PHP_FE(ip2location_get_elevation, NULL)
+- PHP_FE(ip2location_get_usagetype, NULL)
+- PHP_FE(ip2location_get_all, NULL)
+- PHP_FE(ip2location_close, NULL)
+- PHP_FE(ip2location_delete_shm, NULL)
++ PHP_FE(ip2location_open, ip2location_open)
++ PHP_FE(ip2location_open_mem, ip2location_open_mem)
++ PHP_FE(ip2location_get_country_short, ip2location_ip_address)
++ PHP_FE(ip2location_get_country_long, ip2location_ip_address)
++ PHP_FE(ip2location_get_region, ip2location_ip_address)
++ PHP_FE(ip2location_get_city, ip2location_ip_address)
++ PHP_FE(ip2location_get_isp, ip2location_ip_address)
++ PHP_FE(ip2location_get_latitude, ip2location_ip_address)
++ PHP_FE(ip2location_get_longitude, ip2location_ip_address)
++ PHP_FE(ip2location_get_domain, ip2location_ip_address)
++ PHP_FE(ip2location_get_zipcode, ip2location_ip_address)
++ PHP_FE(ip2location_get_timezone, ip2location_ip_address)
++ PHP_FE(ip2location_get_netspeed, ip2location_ip_address)
++ PHP_FE(ip2location_get_iddcode, ip2location_ip_address)
++ PHP_FE(ip2location_get_areacode, ip2location_ip_address)
++ PHP_FE(ip2location_get_weatherstationcode, ip2location_ip_address)
++ PHP_FE(ip2location_get_weatherstationname, ip2location_ip_address)
++ PHP_FE(ip2location_get_mcc, ip2location_ip_address)
++ PHP_FE(ip2location_get_mnc, ip2location_ip_address)
++ PHP_FE(ip2location_get_mobilebrand, ip2location_ip_address)
++ PHP_FE(ip2location_get_elevation, ip2location_ip_address)
++ PHP_FE(ip2location_get_usagetype, ip2location_ip_address)
++ PHP_FE(ip2location_get_all, ip2location_ip_address)
++ PHP_FE(ip2location_close, ip2location_void)
++ PHP_FE(ip2location_delete_shm, ip2location_void)
++#ifdef PHP_FE_END
++ PHP_FE_END
++#else
+ {NULL, NULL, NULL}
++#endif
+ };
+
+ /* the following code creates an entry for the module and registers it with Zend.*/
+@@ -408,7 +432,7 @@ PHP_FUNCTION(ip2location_get_timezone)
+ /* }}} */
+
+
+-#if API_VERSION_NUMERIC >= 80100
++#if API_VERSION_NUMERIC == 80100
+ /* see https://github.com/chrislim2888/IP2Location-C-Library/issues/37 */
+ IP2LocationRecord *IP2Location_get_netspeed(IP2Location *handler, char *ip);
+ #endif
diff --git a/PHPINFO b/PHPINFO
new file mode 100644
index 0000000..ba28650
--- /dev/null
+++ b/PHPINFO
@@ -0,0 +1,6 @@
+
+ip2location
+
+ip2location support => enabled
+extension version => 8.0.1
+library version => 8.0.9
diff --git a/REFLECTION b/REFLECTION
index 775ce61..45d46eb 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,62 +1,160 @@
-Extension [ <persistent> extension #100 ip2location version 8.0.1 ] {
+Extension [ <persistent> extension #117 ip2location version 8.0.1 ] {
- Constants [4] {
- Constant [ integer IP2LOCATION_FILE_IO ] { 0 }
- Constant [ integer IP2LOCATION_CACHE_MEMORY ] { 1 }
- Constant [ integer IP2LOCATION_SHARED_MEMORY ] { 2 }
- Constant [ integer IP2LOCATION_RECORD ] { 0 }
+ Constant [ int IP2LOCATION_FILE_IO ] { 0 }
+ Constant [ int IP2LOCATION_CACHE_MEMORY ] { 1 }
+ Constant [ int IP2LOCATION_SHARED_MEMORY ] { 2 }
+ Constant [ int IP2LOCATION_RECORD ] { 0 }
}
- Functions {
Function [ <internal:ip2location> function ip2location_open ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $file_path ]
+ }
}
Function [ <internal:ip2location> function ip2location_open_mem ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $method ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_country_short ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_country_long ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_region ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_city ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_isp ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_latitude ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_longitude ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_domain ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_zipcode ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_timezone ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_netspeed ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_iddcode ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_areacode ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_weatherstationcode ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_weatherstationname ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_mcc ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_mnc ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_mobilebrand ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_elevation ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_usagetype ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_get_all ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $ip_address ]
+ }
}
Function [ <internal:ip2location> function ip2location_close ] {
+
+ - Parameters [0] {
+ }
}
Function [ <internal:ip2location> function ip2location_delete_shm ] {
+
+ - Parameters [0] {
+ }
}
}
}
diff --git a/php-pecl-ip2location.spec b/php-pecl-ip2location.spec
index 8c955a1..d0d55fc 100644
--- a/php-pecl-ip2location.spec
+++ b/php-pecl-ip2location.spec
@@ -1,6 +1,6 @@
# remirepo spec file for php-pecl-ip2location
#
-# Copyright (c) 2020 Remi Collet
+# Copyright (c) 2017-2020 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
@@ -16,7 +16,7 @@
%if "%{php_version}" < "5.6"
%global ini_name %{pecl_name}.ini
%else
-%global ini_name 40-%{pecl_name}.ini
+%global ini_name 40-%{pecl_name}.ini
%endif
%global upstream_version 8.0.1
@@ -24,20 +24,27 @@
Summary: Get geo location information of an IP address
Name: %{?sub_prefix}php-pecl-%{pecl_name}
+License: PHP
Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
-Release: 5%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Release: 6%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
URL: https://pecl.php.net/package/igbinary
Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz
-License: PHP
-Group: System Environment/Libraries
-# https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/5
+# https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/5 - test suite
Patch0: https://patch-diff.githubusercontent.com/raw/chrislim2888/IP2Location-PECL-Extension/pull/5.patch
+# https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/8 - library 8.1
+Patch1: https://patch-diff.githubusercontent.com/raw/chrislim2888/IP2Location-PECL-Extension/pull/8.patch
+# https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/9 - PHP 8
+Patch2: https://patch-diff.githubusercontent.com/raw/chrislim2888/IP2Location-PECL-Extension/pull/9.patch
+# https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/10 - display version
+Patch3: https://patch-diff.githubusercontent.com/raw/chrislim2888/IP2Location-PECL-Extension/pull/10.patch
+# https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/11 - config.m4
+Patch4: https://patch-diff.githubusercontent.com/raw/chrislim2888/IP2Location-PECL-Extension/pull/11.patch
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-pear
BuildRequires: %{?scl_prefix}php-devel
-BuildRequires: IP2location-devel
+BuildRequires: IP2Location-devel
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
@@ -96,7 +103,12 @@ sed -e 's/role="test"/role="src"/' \
cd NTS
chmod -x *.c *.h LICENSE README
mv test tests
-%patch0 -p1 -b .pr10
+sed -e "s/\r//" -i *.c config.m4
+%patch0 -p1 -b .pr5
+%patch1 -p1 -b .pr8
+%patch2 -p1 -b .pr9
+%patch3 -p1 -b .pr10
+%patch4 -p1 -b .pr11
# Check version
extver=$(sed -n '/#define PHP_IP2LOCATION_VERSION/{s/.* "//;s/".*$//;p}' php_ip2location.h)
@@ -154,7 +166,7 @@ done
%check
-: simple NTS module load test, without APC, as optional
+: simple NTS module load test
%{_bindir}/php --no-php-ini \
--define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
--modules | grep %{pecl_name}
@@ -168,7 +180,7 @@ REPORT_EXIT_STATUS=1 \
%{_bindir}/php -n run-tests.php --show-diff
%if %{with_zts}
-: simple ZTS module load test, without APC, as optional
+: simple ZTS module load test
%{__ztsphp} --no-php-ini \
--define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
--modules | grep %{pecl_name}
@@ -219,6 +231,13 @@ fi
%changelog
+* Fri Sep 25 2020 Remi Collet <remi@remirepo.net> - 8.0.1-6
+- add patches for library version 8.1 and for PHP 8 from
+ https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/8
+ https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/9
+ https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/10
+ https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/11
+
* Tue Sep 03 2019 Remi Collet <remi@remirepo.net> - 8.0.1-5
- rebuild for 7.4.0RC1