From 465bce1910106c9b9eef93276b938caf6f1e8f4a Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 11 Jun 2021 10:14:21 +0200 Subject: add patches for 8.1 from upstream and from https://github.com/m6w6/ext-pq/pull/40 --- .gitignore | 2 + php-pecl-pq.spec | 11 ++- pq-php81.patch | 265 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 pq-php81.patch diff --git a/.gitignore b/.gitignore index 1ab5c4f..01f0400 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/php-pecl-pq.spec b/php-pecl-pq.spec index 06c32bd..ce9c285 100644 --- a/php-pecl-pq.spec +++ b/php-pecl-pq.spec @@ -32,12 +32,15 @@ Version: 2.1.8 Release: 0.11.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz %else -Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz %endif License: BSD URL: https://pecl.php.net/package/%{pecl_name} +# Upstream patches +Patch0: %{pecl_name}-php81.patch + %if 0%{?fedora} >= 29 && 0%{?rhel} >= 8 BuildRequires: libpq-devel > 9 %else @@ -115,6 +118,8 @@ sed -e '/role="test"/d' \ -i package.xml cd NTS +%patch0 -p1 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_PQ_VERSION/{s/.* "//;s/".*$//;p}' php_pq.h) if test "x${extver}" != "x%{version}%{?prever}"; then @@ -282,6 +287,10 @@ exit $RET %changelog +* Fri Jun 11 2021 Remi Collet - 2.1.8-5 +- add patches for 8.1 from upstream and from + https://github.com/m6w6/ext-pq/pull/40 + * Fri Apr 30 2021 Remi Collet - 2.1.8-4 - F34 rebuild for https://github.com/remicollet/remirepo/issues/174 diff --git a/pq-php81.patch b/pq-php81.patch new file mode 100644 index 0000000..3d1fde6 --- /dev/null +++ b/pq-php81.patch @@ -0,0 +1,265 @@ +From c9082b82cd9275d2ff9027b108ea01ab88e70294 Mon Sep 17 00:00:00 2001 +From: Michael Wallner +Date: Fri, 15 Jan 2021 13:38:41 +0100 +Subject: [PATCH] fix PHP-master + +--- + src/php_pq_params.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/php_pq_params.c b/src/php_pq_params.c +index a3ee6b8..259fbb9 100644 +--- a/src/php_pq_params.c ++++ b/src/php_pq_params.c +@@ -307,7 +307,8 @@ static int apply_to_params(zval *zp, void *arg_ptr) + { + struct apply_to_params_arg *arg = arg_ptr; + +- SEPARATE_ZVAL_IF_NOT_REF(zp); ++ ZVAL_DEREF(zp); ++ SEPARATE_ZVAL(zp); + php_pq_params_set_param(arg->params, arg->index++, zp); + return ZEND_HASH_APPLY_KEEP; + } + +From 320bae0144fab755d678317f7ec14f9cb3ae1869 Mon Sep 17 00:00:00 2001 +From: Michael Wallner +Date: Wed, 10 Mar 2021 11:22:50 +0100 +Subject: [PATCH] compatibility with master + +--- + src/php_pq_misc.h | 14 +++++----- + src/php_pqres.c | 4 +-- + tests/res001.phpt | 67 ++++++++++++++++++++++++++--------------------- + 3 files changed, 46 insertions(+), 39 deletions(-) + +diff --git a/src/php_pq_misc.h b/src/php_pq_misc.h +index 07bd596..7ccda3e 100644 +--- a/src/php_pq_misc.h ++++ b/src/php_pq_misc.h +@@ -40,13 +40,6 @@ extern char *php_pq_rtrim(char *e); + /* R, W, RW */ + extern const char *php_pq_strmode(long mode); + +-/* compare array index */ +-#if PHP_VERSION_ID >= 80000 +-extern int php_pq_compare_index(Bucket *lptr, Bucket *rptr); +-#else +-extern int php_pq_compare_index(const void *lptr, const void *rptr); +-#endif +- + /* free zval ptr values (as hash dtor) */ + extern void php_pq_hash_ptr_dtor(zval *p); + +@@ -63,6 +56,8 @@ extern HashTable *php_pq_parse_array(php_pqres_t *res, const char *val_str, size + + /* ZE compat */ + #if PHP_VERSION_ID >= 80000 ++extern int php_pq_compare_index(Bucket *lptr, Bucket *rptr); ++ + # define php_pq_call_method(objval_ptr, method_name, num_args, ...) \ + zend_call_method_with_ ## num_args ## _params( \ + Z_OBJ_P(objval_ptr), Z_OBJCE_P(objval_ptr), NULL, \ +@@ -77,6 +72,11 @@ extern HashTable *php_pq_parse_array(php_pqres_t *res, const char *val_str, size + (Z_OBJ_HT_P(objval_ptr)->cast_object && \ + SUCCESS == Z_OBJ_HT_P(objval_ptr)->cast_object(Z_OBJ_P(objval_ptr), (retval_ptr), (cast_type))) + #else ++ ++extern int php_pq_compare_index(const void *lptr, const void *rptr); ++ ++# define zend_ze_countable spl_ce_Countable ++ + # define php_pq_call_method(objval_ptr, method_name, num_args, ...) \ + zend_call_method_with_ ## num_args ## _params( \ + (objval_ptr), NULL, NULL, \ +diff --git a/src/php_pqres.c b/src/php_pqres.c +index 7e51271..be3d039 100644 +--- a/src/php_pqres.c ++++ b/src/php_pqres.c +@@ -1249,9 +1249,9 @@ PHP_MINIT_FUNCTION(pqres) + php_pqres_class_entry->create_object = php_pqres_create_object; + php_pqres_class_entry->get_iterator = php_pqres_iterator_init; + #if PHP_VERSION_ID >= 80000 +- zend_class_implements(php_pqres_class_entry, 2, zend_ce_aggregate, spl_ce_Countable); ++ zend_class_implements(php_pqres_class_entry, 2, zend_ce_aggregate, zend_ce_countable); + #else +- zend_class_implements(php_pqres_class_entry, 2, zend_ce_traversable, spl_ce_Countable); ++ zend_class_implements(php_pqres_class_entry, 2, zend_ce_traversable, zend_ce_countable); + #endif + + memcpy(&php_pqres_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); +diff --git a/tests/res001.phpt b/tests/res001.phpt +index b2a3667..a325247 100644 +--- a/tests/res001.phpt ++++ b/tests/res001.phpt +@@ -19,7 +19,13 @@ class r extends pq\Result { + public $dummy = 2; + } + +-var_dump(new pq\Result, get_object_vars(new r)); ++var_dump(new pq\Result); ++ ++echo "Test\n"; ++$v = get_object_vars(new r); ++ksort($v); ++var_dump($v); ++ + ?> + Done + --EXPECTF-- +@@ -42,6 +48,27 @@ Warning: pq\Result not initialized in %s on line %d + Warning: pq\Result not initialized in %s on line %d + + Warning: pq\Result not initialized in %s on line %d ++object(pq\Result)#%d (9) { ++ ["status"]=> ++ NULL ++ ["statusMessage"]=> ++ NULL ++ ["errorMessage"]=> ++ NULL ++ ["diag"]=> ++ NULL ++ ["numRows"]=> ++ int(0) ++ ["numCols"]=> ++ int(0) ++ ["affectedRows"]=> ++ int(0) ++ ["fetchType"]=> ++ int(0) ++ ["autoConvert"]=> ++ int(65535) ++} ++Test + + Warning: pq\Result not initialized in %s on line %d + +@@ -62,46 +89,26 @@ Warning: pq\Result not initialized in %s on line %d + Warning: pq\Result not initialized in %s on line %d + + Warning: pq\Result not initialized in %s on line %d +-object(pq\Result)#%d (9) { +- ["status"]=> +- NULL +- ["statusMessage"]=> +- NULL +- ["errorMessage"]=> +- NULL +- ["diag"]=> +- NULL +- ["numRows"]=> +- int(0) +- ["numCols"]=> +- int(0) ++array(10) { + ["affectedRows"]=> + int(0) +- ["fetchType"]=> +- int(0) + ["autoConvert"]=> + int(65535) +-} +-array(10) { ++ ["diag"]=> ++ NULL + ["dummy"]=> + int(2) +- ["status"]=> +- NULL +- ["statusMessage"]=> +- NULL + ["errorMessage"]=> + NULL +- ["diag"]=> +- NULL +- ["numRows"]=> ++ ["fetchType"]=> + int(0) + ["numCols"]=> + int(0) +- ["affectedRows"]=> +- int(0) +- ["fetchType"]=> ++ ["numRows"]=> + int(0) +- ["autoConvert"]=> +- int(65535) ++ ["status"]=> ++ NULL ++ ["statusMessage"]=> ++ NULL + } + Done + +From 7109996c98ad7df145d88693167023b7b9be9f8c Mon Sep 17 00:00:00 2001 +From: Michael Wallner +Date: Wed, 10 Mar 2021 13:33:17 +0100 +Subject: [PATCH] typo + +--- + src/php_pq_misc.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/php_pq_misc.h b/src/php_pq_misc.h +index 7ccda3e..1285d8e 100644 +--- a/src/php_pq_misc.h ++++ b/src/php_pq_misc.h +@@ -75,7 +75,7 @@ extern int php_pq_compare_index(Bucket *lptr, Bucket *rptr); + + extern int php_pq_compare_index(const void *lptr, const void *rptr); + +-# define zend_ze_countable spl_ce_Countable ++# define zend_ce_countable spl_ce_Countable + + # define php_pq_call_method(objval_ptr, method_name, num_args, ...) \ + zend_call_method_with_ ## num_args ## _params( \ + +From 54542ca3e96ba72090f188692995047ae70d5d28 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 11 Jun 2021 10:01:07 +0200 +Subject: [PATCH] fix prototype for 8.1 + +--- + src/php_pq_misc.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/php_pq_misc.c b/src/php_pq_misc.c +index 3e334c6..9e622b4 100644 +--- a/src/php_pq_misc.c ++++ b/src/php_pq_misc.c +@@ -131,6 +131,13 @@ void php_pq_hash_ptr_dtor(zval *p) + + zend_class_entry *php_pqdt_class_entry; + ++#if PHP_VERSION_ID >= 80100 ++ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_pqdt_jsonserialize, 0, 0, IS_MIXED, 0) ++#else ++#define ai_pqdt_jsonserialize ai_pqdt_to_string ++#endif ++ZEND_END_ARG_INFO() ++ + ZEND_BEGIN_ARG_INFO_EX(ai_pqdt_to_string, 0, 0, 0) + ZEND_END_ARG_INFO(); + static PHP_METHOD(pqdt, __toString) +@@ -142,7 +149,11 @@ static PHP_METHOD(pqdt, __toString) + RETVAL_ZVAL(&rv, 1, 1); + } + ++#if PHP_VERSION_ID >= 80100 ++ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(ai_pqdt_create_from_format, 0, 2, DateTime, MAY_BE_FALSE) ++#else + ZEND_BEGIN_ARG_INFO_EX(ai_pqdt_create_from_format, 0, 0, 2) ++#endif + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, datetime) + #if PHP_VERSION_ID >= 70200 +@@ -171,7 +182,7 @@ static PHP_METHOD(pqdt, createFromFormat) + static zend_function_entry php_pqdt_methods[] = { + PHP_ME(pqdt, createFromFormat, ai_pqdt_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(pqdt, __toString, ai_pqdt_to_string, ZEND_ACC_PUBLIC) +- PHP_MALIAS(pqdt, jsonSerialize, __toString, ai_pqdt_to_string, ZEND_ACC_PUBLIC) ++ PHP_MALIAS(pqdt, jsonSerialize, __toString, ai_pqdt_jsonserialize, ZEND_ACC_PUBLIC) + {0} + }; + -- cgit