From 757719a6ca5befc5f60765d1d46b762d4be73599 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 16 Oct 2023 08:57:01 +0200 Subject: update to 3.1.0RC1 add patch for old libevent in EL-7 and EL-8 --- PHPINFO | 2 +- REFLECTION | 18 ++++---- event-build.patch | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-event.spec | 16 +++++-- 4 files changed, 144 insertions(+), 11 deletions(-) create mode 100644 event-build.patch diff --git a/PHPINFO b/PHPINFO index 01048d8..22ec1ab 100644 --- a/PHPINFO +++ b/PHPINFO @@ -7,5 +7,5 @@ Debug support => disabled Extra functionality support including HTTP, DNS, and RPC => enabled OpenSSL support => enabled Thread safety support => disabled -Extension version => 3.0.8 +Extension version => 3.1.0RC1 libevent2 headers version => 2.1.12-stable diff --git a/REFLECTION b/REFLECTION index daf4066..4e9c65c 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #120 event version 3.0.8 ] { +Extension [ extension #126 event version 3.1.0RC1 ] { - Dependencies { Dependency [ sockets (Required) ] @@ -875,12 +875,15 @@ Extension [ extension #120 event version 3.0.8 ] { Class [ final class EventDnsBase ] { - - Constants [5] { + - Constants [8] { Constant [ public int OPTION_SEARCH ] { 1 } Constant [ public int OPTION_NAMESERVERS ] { 2 } Constant [ public int OPTION_MISC ] { 4 } Constant [ public int OPTION_HOSTSFILE ] { 8 } Constant [ public int OPTIONS_ALL ] { 15 } + Constant [ public int DISABLE_WHEN_INACTIVE ] { 32768 } + Constant [ public int INITIALIZE_NAMESERVERS ] { 1 } + Constant [ public int NAMESERVERS_NO_DEFAULT ] { 65536 } } - Static properties [0] { @@ -897,7 +900,7 @@ Extension [ extension #120 event version 3.0.8 ] { - Parameters [2] { Parameter #0 [ EventBase $base ] - Parameter #1 [ bool $initialize ] + Parameter #1 [ mixed $initialize ] } } @@ -1674,8 +1677,8 @@ Extension [ extension #120 event version 3.0.8 ] { Constant [ public int OPT_CIPHER_SERVER_PREFERENCE ] { 15 } Constant [ public int OPT_REQUIRE_CLIENT_CERT ] { 16 } Constant [ public int OPT_VERIFY_CLIENT_ONCE ] { 17 } - Constant [ public string OPENSSL_VERSION_TEXT ] { OpenSSL 1.1.1n FIPS 15 Mar 2022 } - Constant [ public int OPENSSL_VERSION_NUMBER ] { 269488367 } + Constant [ public string OPENSSL_VERSION_TEXT ] { OpenSSL 3.0.9 30 May 2023 } + Constant [ public int OPENSSL_VERSION_NUMBER ] { 805306512 } Constant [ public int SSL3_VERSION ] { 768 } Constant [ public int TLS1_VERSION ] { 769 } Constant [ public int TLS1_1_VERSION ] { 770 } @@ -1736,8 +1739,8 @@ Extension [ extension #120 event version 3.0.8 ] { - Properties [5] { Property [ protected $message = '' ] Property [ protected $code = 0 ] - Property [ protected $file = NULL ] - Property [ protected $line = NULL ] + Property [ protected string $file = '' ] + Property [ protected int $line = 0 ] Property [ public $errorInfo = NULL ] } @@ -1755,6 +1758,7 @@ Extension [ extension #120 event version 3.0.8 ] { - Parameters [0] { } + - Tentative return [ void ] } Method [ final public method getMessage ] { 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 +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 + diff --git a/php-pecl-event.spec b/php-pecl-event.spec index 2f33373..5ff4ff0 100644 --- a/php-pecl-event.spec +++ b/php-pecl-event.spec @@ -33,8 +33,8 @@ # After 20-sockets.so %global ini_name 40-%{pecl_name}.ini %endif -%global upstream_version 3.0.8 -#global upstream_prever RC1 +%global upstream_version 3.1.0 +%global upstream_prever RC1 #global upstream_postver r1 %global sources %{pecl_name}-%{upstream_version}%{?upstream_prever} %global _configure ../%{sources}/configure @@ -42,11 +42,14 @@ Summary: Provides interface to libevent library Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}%{?upstream_postver:+%{upstream_postver}} -Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: PHP-3.01 URL: https://pecl.php.net/package/event Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}%{?upstream_postver}.tgz +# For libevent < 2.1.10 +Patch0: %{pecl_name}-build.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel @@ -93,6 +96,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd %{sources} +%patch -P0 -p1 + # Sanity check, really often broken DIR=$(%{__php} -r 'echo "php" . PHP_MAJOR_VERSION;') #sed -e '/PHP_EVENT_VERSION/s/2.4.2/2.4.3/' -i $DIR/php_event.h @@ -175,6 +180,7 @@ done cd %{sources} %if "%{php_version}" < "7" rm tests/61-issue.phpt +rm tests/61-issue_php_pre_8_2_0.phpt rm tests/10-event-data-dtor.phpt rm tests/27-event-util-create-socket.phpt %endif @@ -249,6 +255,10 @@ fi %changelog +* Mon Oct 16 2023 Remi Collet - 3.1.0~RC1-1 +- update to 3.1.0RC1 +- add patch for old libevent in EL-7 and EL-8 + * Wed Aug 30 2023 Remi Collet - 3.0.8-3 - rebuild for PHP 8.3.0RC1 -- cgit