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
|
From cc5731a3b1c0257a7e227443dca69b64f2dbc4d0 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Tue, 1 Oct 2019 09:25:39 +0200
Subject: [PATCH 1/2] expose MMDB_LIB_VERSION to userland
---
ext/maxminddb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/ext/maxminddb.c b/ext/maxminddb.c
index 91dd706..239decc 100644
--- a/ext/maxminddb.c
+++ b/ext/maxminddb.c
@@ -665,6 +665,7 @@ PHP_MINIT_FUNCTION(maxminddb) {
maxminddb_obj_handlers.offset = XtOffsetOf(maxminddb_obj, std);
maxminddb_obj_handlers.free_obj = maxminddb_free_storage;
#endif
+ zend_declare_class_constant_string(maxminddb_ce, "MMDB_LIB_VERSION", sizeof("MMDB_LIB_VERSION")-1, MMDB_lib_version() TSRMLS_CC);
return SUCCESS;
}
From 91e160eaf465d1646f18ecf182271d59ab219d31 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Tue, 1 Oct 2019 09:30:37 +0200
Subject: [PATCH 2/2] skip test when running with extension build against old
library
---
tests/MaxMind/Db/Test/ReaderTest.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/MaxMind/Db/Test/ReaderTest.php b/tests/MaxMind/Db/Test/ReaderTest.php
index 773bedd..3cbd0ff 100644
--- a/tests/MaxMind/Db/Test/ReaderTest.php
+++ b/tests/MaxMind/Db/Test/ReaderTest.php
@@ -243,6 +243,9 @@ public function testGetWithPrefixLen()
*/
public function testV6AddressV4Database()
{
+ if (defined("MaxMind\\Db\\Reader::MMDB_LIB_VERSION") && version_compare(Reader::MMDB_LIB_VERSION, '1.2.0', '<')) {
+ $this->markTestSkipped('MMDB_LIB_VERSION < 1.2.0');
+ }
$reader = new Reader('tests/data/test-data/MaxMind-DB-test-ipv4-24.mmdb');
$reader->get('2001::');
}
|