summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-01-29 17:18:45 +0100
committerRemi Collet <remi@php.net>2024-01-29 17:18:45 +0100
commit41cdf652f6ebf992c05b35f885859fb1e924f604 (patch)
tree663b5990e7c46ccea2c3a693f2699930c226b90b
parent0141220a26edbbf0225e327d3ea28f47414737c2 (diff)
Fix incompatible pointer types using patch from
https://github.com/m6w6/ext-pq/pull/52
-rw-r--r--php-pecl-pq.spec12
-rw-r--r--pq-build.patch111
2 files changed, 121 insertions, 2 deletions
diff --git a/php-pecl-pq.spec b/php-pecl-pq.spec
index f53e23f..217ef0e 100644
--- a/php-pecl-pq.spec
+++ b/php-pecl-pq.spec
@@ -1,6 +1,6 @@
# remirepo spec file for php-pecl-pq
#
-# Copyright (c) 2014-2023 Remi Collet
+# Copyright (c) 2014-2024 Remi Collet
# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
@@ -23,11 +23,13 @@
Summary: PostgreSQL client library (libpq) binding
Name: %{?scl_prefix}php-pecl-%{pecl_name}
Version: 2.2.2
-Release: 2%{?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
License: BSD-2-Clause
URL: https://pecl.php.net/package/%{pecl_name}
+Patch0: %{pecl_name}-build.patch
+
%if 0%{?fedora} >= 29 && 0%{?rhel} >= 8
BuildRequires: libpq-devel > 9
%else
@@ -78,6 +80,8 @@ sed -e '/role="test"/d' \
-i package.xml
cd %{sources}
+%patch -P0 -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
@@ -246,6 +250,10 @@ exit $RET
%changelog
+* Mon Jan 29 2024 Remi Collet <remi@remirepo.net> - 2.2.2-5
+- Fix incompatible pointer types using patch from
+ https://github.com/m6w6/ext-pq/pull/52
+
* Wed Aug 30 2023 Remi Collet <remi@remirepo.net> - 2.2.2-2
- rebuild for PHP 8.3.0RC1
diff --git a/pq-build.patch b/pq-build.patch
new file mode 100644
index 0000000..ce15782
--- /dev/null
+++ b/pq-build.patch
@@ -0,0 +1,111 @@
+From e81e57aadf5647511f5c27843ea565a141cf2e3d Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 29 Jan 2024 16:47:49 +0100
+Subject: [PATCH 1/3] Fix incompatible pointer types
+
+---
+ src/php_pqlob.c | 2 +-
+ src/php_pqres.c | 8 ++++----
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/php_pqlob.c b/src/php_pqlob.c
+index 0cb44a8..a419390 100644
+--- a/src/php_pqlob.c
++++ b/src/php_pqlob.c
+@@ -169,7 +169,7 @@ static int php_pqlob_stream_flush(php_stream *stream)
+ return SUCCESS;
+ }
+
+-static ZEND_RESULT_CODE php_pqlob_stream_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset)
++static ZEND_RESULT_CODE php_pqlob_stream_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset)
+ {
+ ZEND_RESULT_CODE rv = FAILURE;
+ php_pqlob_object_t *obj = stream->abstract;
+diff --git a/src/php_pqres.c b/src/php_pqres.c
+index e9de463..c8262ac 100644
+--- a/src/php_pqres.c
++++ b/src/php_pqres.c
+@@ -398,24 +398,24 @@ static zend_object_iterator_funcs php_pqres_iterator_funcs = {
+ #endif
+ };
+
+-static inline ZEND_RESULT_CODE php_pqres_count_elements_ex(zend_object *object, long *count)
++static inline ZEND_RESULT_CODE php_pqres_count_elements_ex(zend_object *object, zend_long *count)
+ {
+ php_pqres_object_t *obj = PHP_PQ_OBJ(NULL, object);
+
+ if (!obj->intern) {
+ return FAILURE;
+ } else {
+- *count = (long) PQntuples(obj->intern->res);
++ *count = (zend_long) PQntuples(obj->intern->res);
+ return SUCCESS;
+ }
+ }
+ #if PHP_VERSION_ID >= 80000
+-static ZEND_RESULT_CODE php_pqres_count_elements(zend_object *object, long *count)
++static ZEND_RESULT_CODE php_pqres_count_elements(zend_object *object, zend_long *count)
+ {
+ return php_pqres_count_elements_ex(object, count);
+ }
+ #else
+-static ZEND_RESULT_CODE php_pqres_count_elements(zval *object, long *count)
++static ZEND_RESULT_CODE php_pqres_count_elements(zval *object, zend_long *count)
+ {
+ return php_pqres_count_elements_ex(Z_OBJ_P(object), count);
+ }
+
+From 77dce501422e1402bb70ba3aad94e070850aaa3b Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 29 Jan 2024 16:50:42 +0100
+Subject: [PATCH 2/3] Fix [-Wformat=]
+
+---
+ src/php_pqres.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/php_pqres.c b/src/php_pqres.c
+index c8262ac..e3986c5 100644
+--- a/src/php_pqres.c
++++ b/src/php_pqres.c
+@@ -736,7 +736,7 @@ static ZEND_RESULT_CODE column_nn(php_pqres_object_t *obj, zval *zcol, php_pqres
+ }
+
+ if (!col->name) {
+- php_error_docref(NULL, E_WARNING, "Failed to find column at index %ld", index);
++ php_error_docref(NULL, E_WARNING, "Failed to find column at index " ZEND_LONG_FMT, index);
+ return FAILURE;
+ }
+ if (col->num == -1) {
+@@ -791,7 +791,7 @@ static int apply_bound(zval *zbound, int argc, va_list argv, zend_hash_key *key)
+ ZEND_RESULT_CODE *rv = va_arg(argv, ZEND_RESULT_CODE *);
+
+ if (!(zvalue = zend_hash_index_find(Z_ARRVAL_P(zrow), key->h))) {
+- php_error_docref(NULL, E_WARNING, "Failed to find column ad index %lu", key->h);
++ php_error_docref(NULL, E_WARNING, "Failed to find column ad index " ZEND_ULONG_FMT, key->h);
+ *rv = FAILURE;
+ return ZEND_HASH_APPLY_STOP;
+ } else {
+
+From ea88a82879ac87d41c03d80ea285d843346f2114 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 29 Jan 2024 17:05:04 +0100
+Subject: [PATCH 3/3] Fix incompatible pointer types
+
+---
+ src/php_pqres.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/php_pqres.c b/src/php_pqres.c
+index e3986c5..802fcf4 100644
+--- a/src/php_pqres.c
++++ b/src/php_pqres.c
+@@ -1172,7 +1172,7 @@ static PHP_METHOD(pqres, count) {
+ zend_restore_error_handling(&zeh);
+
+ if (SUCCESS == rv) {
+- long count;
++ zend_long count;
+
+ if (SUCCESS != php_pqres_count_elements_ex(Z_OBJ_P(getThis()), &count)) {
+ throw_exce(EX_UNINITIALIZED, "pq\\Result not initialized");