summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--108.patch159
-rw-r--r--php-maxminddb.spec9
2 files changed, 167 insertions, 1 deletions
diff --git a/108.patch b/108.patch
new file mode 100644
index 0000000..bb4af8b
--- /dev/null
+++ b/108.patch
@@ -0,0 +1,159 @@
+From c529551dbb98575df6127e72122bc8c2b63d9fdd Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 2 Sep 2020 11:24:30 +0200
+Subject: [PATCH] fix for 8.0.0beta3
+
+---
+ ext/maxminddb.c | 50 +++++++++++++++++++++++--------------------------
+ 1 file changed, 23 insertions(+), 27 deletions(-)
+
+diff --git a/ext/maxminddb.c b/ext/maxminddb.c
+index 4947492..f94d741 100644
+--- a/ext/maxminddb.c
++++ b/ext/maxminddb.c
+@@ -45,15 +45,21 @@ typedef size_t strsize_t;
+ typedef zend_object free_obj_t;
+
+ /* For PHP 8 compatibility */
+-#ifndef TSRMLS_C
++#if PHP_VERSION_ID < 80000
++
++#define PROP_OBJ(zv) (zv)
++
++#else
++
++#define PROP_OBJ(zv) Z_OBJ_P(zv)
++
+ #define TSRMLS_C
+-#endif
+-#ifndef TSRMLS_CC
+ #define TSRMLS_CC
+-#endif
+-#ifndef TSRMLS_DC
+ #define TSRMLS_DC
++
++/* End PHP 8 compatibility */
+ #endif
++
+ #ifndef ZEND_ACC_CTOR
+ #define ZEND_ACC_CTOR 0
+ #endif
+@@ -334,23 +340,13 @@ PHP_METHOD(MaxMind_Db_Reader, metadata) {
+ return;
+ }
+ MMDB_free_entry_data_list(entry_data_list);
+-#if PHP_VERSION_ID >= 80000
+- zend_call_method_with_1_params(Z_OBJ_P(return_value),
++ zend_call_method_with_1_params(PROP_OBJ(return_value),
+ metadata_ce,
+ &metadata_ce->constructor,
+ ZEND_CONSTRUCTOR_FUNC_NAME,
+ NULL,
+ &metadata_array);
+ zval_ptr_dtor(&metadata_array);
+-#else
+- zend_call_method_with_1_params(return_value,
+- metadata_ce,
+- &metadata_ce->constructor,
+- ZEND_CONSTRUCTOR_FUNC_NAME,
+- NULL,
+- &metadata_array);
+- zval_ptr_dtor(&metadata_array);
+-#endif
+ }
+
+ PHP_METHOD(MaxMind_Db_Reader, close) {
+@@ -607,7 +603,7 @@ PHP_METHOD(MaxMind_Db_Reader_Metadata, __construct) {
+ "binary_format_major_version",
+ sizeof("binary_format_major_version") - 1))) {
+ zend_update_property(metadata_ce,
+- object,
++ PROP_OBJ(object),
+ "binaryFormatMajorVersion",
+ sizeof("binaryFormatMajorVersion") - 1,
+ tmp);
+@@ -617,7 +613,7 @@ PHP_METHOD(MaxMind_Db_Reader_Metadata, __construct) {
+ "binary_format_minor_version",
+ sizeof("binary_format_minor_version") - 1))) {
+ zend_update_property(metadata_ce,
+- object,
++ PROP_OBJ(object),
+ "binaryFormatMinorVersion",
+ sizeof("binaryFormatMinorVersion") - 1,
+ tmp);
+@@ -627,14 +623,14 @@ PHP_METHOD(MaxMind_Db_Reader_Metadata, __construct) {
+ "build_epoch",
+ sizeof("build_epoch") - 1))) {
+ zend_update_property(
+- metadata_ce, object, "buildEpoch", sizeof("buildEpoch") - 1, tmp);
++ metadata_ce, PROP_OBJ(object), "buildEpoch", sizeof("buildEpoch") - 1, tmp);
+ }
+
+ if ((tmp = zend_hash_str_find(HASH_OF(metadata_array),
+ "database_type",
+ sizeof("database_type") - 1))) {
+ zend_update_property(metadata_ce,
+- object,
++ PROP_OBJ(object),
+ "databaseType",
+ sizeof("databaseType") - 1,
+ tmp);
+@@ -644,27 +640,27 @@ PHP_METHOD(MaxMind_Db_Reader_Metadata, __construct) {
+ "description",
+ sizeof("description") - 1))) {
+ zend_update_property(
+- metadata_ce, object, "description", sizeof("description") - 1, tmp);
++ metadata_ce, PROP_OBJ(object), "description", sizeof("description") - 1, tmp);
+ }
+
+ if ((tmp = zend_hash_str_find(HASH_OF(metadata_array),
+ "ip_version",
+ sizeof("ip_version") - 1))) {
+ zend_update_property(
+- metadata_ce, object, "ipVersion", sizeof("ipVersion") - 1, tmp);
++ metadata_ce, PROP_OBJ(object), "ipVersion", sizeof("ipVersion") - 1, tmp);
+ }
+
+ if ((tmp = zend_hash_str_find(
+ HASH_OF(metadata_array), "languages", sizeof("languages") - 1))) {
+ zend_update_property(
+- metadata_ce, object, "languages", sizeof("languages") - 1, tmp);
++ metadata_ce, PROP_OBJ(object), "languages", sizeof("languages") - 1, tmp);
+ }
+
+ if ((tmp = zend_hash_str_find(HASH_OF(metadata_array),
+ "record_size",
+ sizeof("record_size") - 1))) {
+ zend_update_property(
+- metadata_ce, object, "recordSize", sizeof("recordSize") - 1, tmp);
++ metadata_ce, PROP_OBJ(object), "recordSize", sizeof("recordSize") - 1, tmp);
+ if (Z_TYPE_P(tmp) == IS_LONG) {
+ record_size = Z_LVAL_P(tmp);
+ }
+@@ -672,7 +668,7 @@ PHP_METHOD(MaxMind_Db_Reader_Metadata, __construct) {
+
+ if (record_size != 0) {
+ zend_update_property_long(metadata_ce,
+- object,
++ PROP_OBJ(object),
+ "nodeByteSize",
+ sizeof("nodeByteSize") - 1,
+ record_size / 4);
+@@ -682,7 +678,7 @@ PHP_METHOD(MaxMind_Db_Reader_Metadata, __construct) {
+ "node_count",
+ sizeof("node_count") - 1))) {
+ zend_update_property(
+- metadata_ce, object, "nodeCount", sizeof("nodeCount") - 1, tmp);
++ metadata_ce, PROP_OBJ(object), "nodeCount", sizeof("nodeCount") - 1, tmp);
+ if (Z_TYPE_P(tmp) == IS_LONG) {
+ node_count = Z_LVAL_P(tmp);
+ }
+@@ -690,7 +686,7 @@ PHP_METHOD(MaxMind_Db_Reader_Metadata, __construct) {
+
+ if (record_size != 0) {
+ zend_update_property_long(metadata_ce,
+- object,
++ PROP_OBJ(object),
+ "searchTreeSize",
+ sizeof("searchTreeSize") - 1,
+ record_size * node_count / 4);
diff --git a/php-maxminddb.spec b/php-maxminddb.spec
index c7cf204..69d1660 100644
--- a/php-maxminddb.spec
+++ b/php-maxminddb.spec
@@ -32,7 +32,7 @@
Summary: MaxMind DB Reader extension
Name: %{?sub_prefix}php-maxminddb
Version: 1.7.0
-%global rpmrel 1
+%global rpmrel 2
Release: %{rpmrel}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: ASL 2.0
URL: https://github.com/%{gh_owner}/%{gh_project}
@@ -41,6 +41,8 @@ URL: https://github.com/%{gh_owner}/%{gh_project}
Source0: %{pkg_name}-%{version}-%{gh_short}.tgz
Source1: makesrc.sh
+Patch0: https://patch-diff.githubusercontent.com/raw/maxmind/MaxMind-DB-Reader-php/pull/108.patch
+
BuildRequires: %{?scl_prefix}php-devel >= 7.2
BuildRequires: %{?scl_prefix}php-pear >= 1.10
BuildRequires: pkgconfig(libmaxminddb) >= 1.0.0
@@ -158,6 +160,7 @@ Autoloader: %{_datadir}/php/MaxMind/Db/Reader/autoload.php
%prep
%setup -q -n %{gh_project}-%{gh_commit}
+%patch0 -p1 -b .pr
%if %{with_lib}
%{_bindir}/phpab \
@@ -331,6 +334,10 @@ fi
# when using pkgup, CHECK Release!
%changelog
+* Wed Sep 2 2020 Remi Collet <remi@remirepo.net> - 1.7.0-2
+- add patch for PHP 8.0.0beta3 from
+ https://github.com/maxmind/MaxMind-DB-Reader-php/pull/108
+
* Sat Aug 8 2020 Remi Collet <remi@remirepo.net> - 1.7.0-1
- update to 1.7.0
- now available on pecl