summaryrefslogtreecommitdiffstats
path: root/15.patch
diff options
context:
space:
mode:
Diffstat (limited to '15.patch')
-rw-r--r--15.patch106
1 files changed, 106 insertions, 0 deletions
diff --git a/15.patch b/15.patch
new file mode 100644
index 0000000..ca21ec9
--- /dev/null
+++ b/15.patch
@@ -0,0 +1,106 @@
+From 8a24f22087beca64a579fb4685f7ead92ccb535f Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 30 Oct 2020 10:05:59 +0100
+Subject: [PATCH] add ip2location_bin_version from library version 8.3.0
+
+---
+ ip2location.c | 30 ++++++++++++++++++++++++++++--
+ php_ip2location.h | 3 +++
+ tests/file.phpt | 2 ++
+ 3 files changed, 33 insertions(+), 2 deletions(-)
+
+diff --git a/ip2location.c b/ip2location.c
+index 198410a..e849e52 100644
+--- a/ip2location.c
++++ b/ip2location.c
+@@ -76,6 +76,9 @@ static zend_function_entry ip2location_functions_entry[] = {
+ PHP_FE(ip2location_get_all, ip2location_ip_address)
+ PHP_FE(ip2location_close, ip2location_void)
+ PHP_FE(ip2location_delete_shm, ip2location_void)
++#if API_VERSION_NUMERIC >= 80300
++ PHP_FE(ip2location_bin_version, ip2location_void)
++#endif
+ #ifdef PHP_FE_END
+ PHP_FE_END
+ #else
+@@ -805,7 +808,7 @@ PHP_FUNCTION(ip2location_get_all)
+ * Returns the record information */
+ PHP_FUNCTION(ip2location_close)
+ {
+- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") != SUCCESS) {
++ if (zend_parse_parameters_none() != SUCCESS) {
+ return;
+ }
+ if (IP2LOCATION_G(ip2location_ptr)) {
+@@ -819,7 +822,7 @@ PHP_FUNCTION(ip2location_close)
+ * Returns nothing */
+ PHP_FUNCTION(ip2location_delete_shm)
+ {
+- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") != SUCCESS) {
++ if (zend_parse_parameters_none() != SUCCESS) {
+ return;
+ }
+ #if API_VERSION_NUMERIC >= 80100
+@@ -830,6 +833,29 @@ PHP_FUNCTION(ip2location_delete_shm)
+ }
+ /* }}} */
+
++#if API_VERSION_NUMERIC >= 80300
++/* {{{ ip2location_open_mem()
++ * Returns the version */
++PHP_FUNCTION(ip2location_bin_version)
++{
++ char *version;
++
++ if (zend_parse_parameters_none() != SUCCESS) {
++ return;
++ }
++
++ PHP_IP2LOCATION_DB_CHECK;
++ version = IP2Location_bin_version(IP2LOCATION_G(ip2location_ptr));
++
++#if PHP_MAJOR_VERSION >= 7
++ RETVAL_STRING(version);
++#else
++ RETVAL_STRING(version, 1);
++#endif
++}
++/* }}} */
++#endif
++
+ /*
+ * Local variables:
+ * tab-width: 4
+diff --git a/php_ip2location.h b/php_ip2location.h
+index f055009..37ec987 100644
+--- a/php_ip2location.h
++++ b/php_ip2location.h
+@@ -64,6 +64,9 @@ PHP_FUNCTION(ip2location_get_usagetype);
+ PHP_FUNCTION(ip2location_get_all);
+ PHP_FUNCTION(ip2location_close);
+ PHP_FUNCTION(ip2location_delete_shm);
++#if API_VERSION_NUMERIC >= 80300
++PHP_FUNCTION(ip2location_bin_version);
++#endif
+
+ ZEND_BEGIN_MODULE_GLOBALS(ip2location)
+ IP2Location *ip2location_ptr;
+diff --git a/tests/file.phpt b/tests/file.phpt
+index 6b6bc4c..6c9a4f5 100644
+--- a/tests/file.phpt
++++ b/tests/file.phpt
+@@ -11,6 +11,7 @@ var_dump(ip2location_open(__DIR__ . '/IP-COUNTRY-SAMPLE.BIN'));
+ var_dump(ip2location_open_mem(IP2LOCATION_FILE_IO));
+ var_dump(ip2location_get_country_short('25.5.10.2'));
+ var_dump(ip2location_get_country_long('25.5.10.2'));
++var_dump(ip2location_bin_version());
+ var_dump(ip2location_close());
+ ?>
+ Done
+@@ -19,5 +20,6 @@ bool(true)
+ bool(true)
+ string(2) "UK"
+ string(14) "UNITED KINGDOM"
++string(9) "2013-4-11"
+ NULL
+ Done