summaryrefslogtreecommitdiffstats
path: root/9.patch
blob: 375cf9759787583513c234b4ece1fc1fb304fdd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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