kumquat-buildroot/package/php-zmq/0002-fix-for-php-7.3.patch
Adam Duskett 23f8a58e9a package/php-zmq: add upstream php8 compatibility patches
These patches are necessary for compiling against php8. These patches also
retain the ability to compile against PHP7.2 and should be removed during the
next version bump.

Signed-off-by: Adam Duskett <aduskett@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2021-07-03 21:56:51 +02:00

44 lines
1.3 KiB
Diff

From e0db82c3286da81fa8945894dd10125a528299e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9gory=20PLANCHAT?=
<gplanchat@users.noreply.github.com>
Date: Wed, 8 Jul 2020 10:09:38 +0200
Subject: [PATCH] Fix for PHP 7.3 (#215)
Co-authored-by: Remi Collet <remi@remirepo.net>
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
zmq.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/zmq.c b/zmq.c
index 66196ea..879704f 100644
--- a/zmq.c
+++ b/zmq.c
@@ -235,7 +235,11 @@ php_zmq_context *php_zmq_context_get(zend_long io_threads, zend_bool is_persiste
le.type = php_zmq_context_list_entry();
le.ptr = context;
+#if PHP_VERSION_ID < 70300
GC_REFCOUNT(&le) = 1;
+#else
+ GC_SET_REFCOUNT(&le, 1);
+#endif
/* plist_key is not a persistent allocated key, thus we use str_update here */
if (zend_hash_str_update_mem(&EG(persistent_list), plist_key->val, plist_key->len, &le, sizeof(le)) == NULL) {
@@ -535,7 +539,11 @@ void php_zmq_socket_store(php_zmq_socket *zmq_sock_p, zend_long type, zend_strin
le.type = php_zmq_socket_list_entry();
le.ptr = zmq_sock_p;
+#if PHP_VERSION_ID < 70300
GC_REFCOUNT(&le) = 1;
+#else
+ GC_SET_REFCOUNT(&le, 1);
+#endif
plist_key = php_zmq_socket_plist_key(type, persistent_id, use_shared_ctx);
--
2.31.1