summaryrefslogtreecommitdiffstats
path: root/event-build.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2023-10-16 08:57:01 +0200
committerRemi Collet <remi@php.net>2023-10-16 08:57:01 +0200
commit757719a6ca5befc5f60765d1d46b762d4be73599 (patch)
tree19773676c3de39784059346cd2033971484b0672 /event-build.patch
parent91fdf064d4ee2f64d877872497729cdd78b04a40 (diff)
update to 3.1.0RC1
add patch for old libevent in EL-7 and EL-8
Diffstat (limited to 'event-build.patch')
-rw-r--r--event-build.patch119
1 files changed, 119 insertions, 0 deletions
diff --git a/event-build.patch b/event-build.patch
new file mode 100644
index 0000000..453a4a6
--- /dev/null
+++ b/event-build.patch
@@ -0,0 +1,119 @@
+From cec64c28a80b2644cce2e9cd6c1fbfecb6439957 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 16 Oct 2023 08:39:26 +0200
+Subject: [PATCH] Fix build with libevent < 2.1.10
+
+---
+ php7/classes/dns.c | 12 +++++++-----
+ php7/php_event.c | 2 ++
+ php8/classes/dns.c | 12 +++++++-----
+ php8/php_event.c | 2 ++
+ tests/36-dns-base-construct-init-flags.phpt | 2 +-
+ 5 files changed, 19 insertions(+), 11 deletions(-)
+
+diff --git a/php7/classes/dns.c b/php7/classes/dns.c
+index 3a7bb37..3286efa 100644
+--- a/php7/classes/dns.c
++++ b/php7/classes/dns.c
+@@ -55,11 +55,11 @@ PHP_METHOD(EventDnsBase, __construct)
+ PHP_EVENT_ASSERT(dnsb);
+ PHP_EVENT_ASSERT(base->base != NULL);
+
+- if (Z_TYPE_P(zinitialize) == IS_TRUE) {
+- flags = EVDNS_BASE_INITIALIZE_NAMESERVERS;
+- } else if (Z_TYPE_P(zinitialize) == IS_FALSE) {
++ if (Z_TYPE_P(zinitialize) == IS_FALSE) {
+ flags = 0;
+ #if LIBEVENT_VERSION_NUMBER >= 0x02010000
++ } else if (Z_TYPE_P(zinitialize) == IS_TRUE) {
++ flags = EVDNS_BASE_INITIALIZE_NAMESERVERS;
+ } else if (Z_TYPE_P(zinitialize) == IS_LONG) {
+ long lflags = Z_LVAL_P(zinitialize);
+
+@@ -70,8 +70,10 @@ PHP_METHOD(EventDnsBase, __construct)
+ flags = lflags;
+
+ if (flags & ~(EVDNS_BASE_DISABLE_WHEN_INACTIVE
+- | EVDNS_BASE_INITIALIZE_NAMESERVERS
+- | EVDNS_BASE_NAMESERVERS_NO_DEFAULT)) {
++#if LIBEVENT_VERSION_NUMBER >= 0x02011000
++ | EVDNS_BASE_NAMESERVERS_NO_DEFAULT
++#endif
++ | EVDNS_BASE_INITIALIZE_NAMESERVERS)) {
+ zend_throw_exception_ex(php_event_get_exception(), 0, "Invalid initialization flags");
+ goto fail;
+ }
+diff --git a/php7/php_event.c b/php7/php_event.c
+index a903020..6676cad 100644
+--- a/php7/php_event.c
++++ b/php7/php_event.c
+@@ -1254,6 +1254,8 @@ PHP_MINIT_FUNCTION(event)
+ /* Constructor initialization flags */
+ PHP_EVENT_REG_CLASS_CONST_LONG(php_event_dns_base_ce, DISABLE_WHEN_INACTIVE, EVDNS_BASE_DISABLE_WHEN_INACTIVE);
+ PHP_EVENT_REG_CLASS_CONST_LONG(php_event_dns_base_ce, INITIALIZE_NAMESERVERS, EVDNS_BASE_INITIALIZE_NAMESERVERS);
++#endif
++#if LIBEVENT_VERSION_NUMBER >= 0x02011000
+ PHP_EVENT_REG_CLASS_CONST_LONG(php_event_dns_base_ce, NAMESERVERS_NO_DEFAULT, EVDNS_BASE_NAMESERVERS_NO_DEFAULT);
+ #endif
+
+diff --git a/php8/classes/dns.c b/php8/classes/dns.c
+index 075b24b..1c08c1e 100644
+--- a/php8/classes/dns.c
++++ b/php8/classes/dns.c
+@@ -55,11 +55,11 @@ PHP_EVENT_METHOD(EventDnsBase, __construct)
+ PHP_EVENT_ASSERT(dnsb);
+ PHP_EVENT_ASSERT(base->base != NULL);
+
+- if (Z_TYPE_P(zinitialize) == IS_TRUE) {
+- flags = EVDNS_BASE_INITIALIZE_NAMESERVERS;
+- } else if (Z_TYPE_P(zinitialize) == IS_FALSE) {
++ if (Z_TYPE_P(zinitialize) == IS_FALSE) {
+ flags = 0;
+ #if LIBEVENT_VERSION_NUMBER >= 0x02010000
++ } else if (Z_TYPE_P(zinitialize) == IS_TRUE) {
++ flags = EVDNS_BASE_INITIALIZE_NAMESERVERS;
+ } else if (Z_TYPE_P(zinitialize) == IS_LONG) {
+ long lflags = Z_LVAL_P(zinitialize);
+
+@@ -70,8 +70,10 @@ PHP_EVENT_METHOD(EventDnsBase, __construct)
+ flags = lflags;
+
+ if (flags & ~(EVDNS_BASE_DISABLE_WHEN_INACTIVE
+- | EVDNS_BASE_INITIALIZE_NAMESERVERS
+- | EVDNS_BASE_NAMESERVERS_NO_DEFAULT)) {
++#if LIBEVENT_VERSION_NUMBER >= 0x02011000
++ | EVDNS_BASE_NAMESERVERS_NO_DEFAULT
++#endif
++ | EVDNS_BASE_INITIALIZE_NAMESERVERS)) {
+ zend_throw_exception_ex(php_event_get_exception(), 0, "Invalid initialization flags");
+ goto fail;
+ }
+diff --git a/php8/php_event.c b/php8/php_event.c
+index e593b80..17b66f3 100644
+--- a/php8/php_event.c
++++ b/php8/php_event.c
+@@ -1200,6 +1200,8 @@ PHP_MINIT_FUNCTION(event)
+ /* Constructor initialization flags */
+ PHP_EVENT_REG_CLASS_CONST_LONG(php_event_dns_base_ce, DISABLE_WHEN_INACTIVE, EVDNS_BASE_DISABLE_WHEN_INACTIVE);
+ PHP_EVENT_REG_CLASS_CONST_LONG(php_event_dns_base_ce, INITIALIZE_NAMESERVERS, EVDNS_BASE_INITIALIZE_NAMESERVERS);
++#endif
++#if LIBEVENT_VERSION_NUMBER >= 0x02011000
+ PHP_EVENT_REG_CLASS_CONST_LONG(php_event_dns_base_ce, NAMESERVERS_NO_DEFAULT, EVDNS_BASE_NAMESERVERS_NO_DEFAULT);
+ #endif
+
+diff --git a/tests/36-dns-base-construct-init-flags.phpt b/tests/36-dns-base-construct-init-flags.phpt
+index c0e8e7d..07cf7fc 100644
+--- a/tests/36-dns-base-construct-init-flags.phpt
++++ b/tests/36-dns-base-construct-init-flags.phpt
+@@ -7,7 +7,7 @@ if (!class_exists(EVENT_NS . "\\EventDnsBase")) {
+ }
+
+ $eventUtilClass = EVENT_NS . '\\EventUtil';
+-if ($eventUtilClass::LIBEVENT_VERSION_NUMBER < 0x02010000) {
++if ($eventUtilClass::LIBEVENT_VERSION_NUMBER < 0x02011000) {
+ die('skip this test is for libevent version >= 2.1');
+ }
+ ?>
+--
+2.41.0
+