diff options
author | Remi Collet <remi@remirepo.net> | 2024-07-09 15:37:40 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2024-07-09 15:37:40 +0200 |
commit | 43eaddf2a0f9abad68e37d10b07eae7e173ed97a (patch) | |
tree | c38135a67679377688f654a4477325067cf17edc | |
parent | 7fd66dfb90f0b99df2a6591361b89ce6dd1c8135 (diff) |
Fix build with PHP 8.4 using patch from
https://github.com/m6w6/ext-http/pull/135
-rw-r--r-- | pecl_http-php84.patch | 100 | ||||
-rw-r--r-- | php-pecl-http.spec | 32 |
2 files changed, 109 insertions, 23 deletions
diff --git a/pecl_http-php84.patch b/pecl_http-php84.patch new file mode 100644 index 0000000..93ca5b1 --- /dev/null +++ b/pecl_http-php84.patch @@ -0,0 +1,100 @@ +From 74984d42a8b71fefc6f3400e0a569f778a0f101e Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Tue, 9 Jul 2024 15:33:05 +0200 +Subject: [PATCH 1/2] Fix header name for 8.4 + +--- + src/php_http_message_body.c | 4 ++++ + src/php_http_misc.c | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/src/php_http_message_body.c b/src/php_http_message_body.c +index 8bde1a77..105e369c 100644 +--- a/src/php_http_message_body.c ++++ b/src/php_http_message_body.c +@@ -12,7 +12,11 @@ + + #include "php_http_api.h" + ++#if PHP_VERSION_ID < 80400 + #include "ext/standard/php_lcg.h" ++#else ++#include "ext/random/php_random.h" ++#endif + + #define BOUNDARY_OPEN(body) \ + do {\ +diff --git a/src/php_http_misc.c b/src/php_http_misc.c +index 261387f6..d5da37fd 100644 +--- a/src/php_http_misc.c ++++ b/src/php_http_misc.c +@@ -12,7 +12,11 @@ + + #include "php_http_api.h" + ++#if PHP_VERSION_ID < 80400 + #include "ext/standard/php_lcg.h" ++#else ++#include "ext/random/php_random.h" ++#endif + #include "zend_exceptions.h" + + /* SLEEP */ + +From e0919d1756b661573a248c8b83705cd05094c0c8 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Tue, 9 Jul 2024 15:33:22 +0200 +Subject: [PATCH 2/2] Fix tests for 8.4 + +--- + tests/client002.phpt | 2 +- + tests/client028.phpt | 2 +- + tests/info002.phpt | 4 ++-- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/client002.phpt b/tests/client002.phpt +index d020f16e..8849ae94 100644 +--- a/tests/client002.phpt ++++ b/tests/client002.phpt +@@ -15,7 +15,7 @@ echo "Test\n"; + class Observer implements SplObserver + { + #[ReturnTypeWillChange] +- function update(SplSubject $client, http\Client\Request $request = null, StdClass $progress = null) { ++ function update(SplSubject $client, ?http\Client\Request $request = null, ?StdClass $progress = null) { + echo "P"; + /* fence against buggy infof() calls in some curl versions */ + $compare = $client->getProgressInfo($request); +diff --git a/tests/client028.phpt b/tests/client028.phpt +index f14fb8e5..58adc685 100644 +--- a/tests/client028.phpt ++++ b/tests/client028.phpt +@@ -80,7 +80,7 @@ class UserHandler implements http\Client\Curl\User + return count($this->client); + } + +- function wait(int $timeout_ms = null) { ++ function wait(?int $timeout_ms = null) { + echo "W"; + + if ($timeout_ms === null) { +diff --git a/tests/info002.phpt b/tests/info002.phpt +index 4d034403..44172b8d 100644 +--- a/tests/info002.phpt ++++ b/tests/info002.phpt +@@ -37,13 +37,13 @@ Test + http\Exception\BadMessageException: http\Message::__construct(): Failed to parse headers: unexpected character '\057' at pos 4 of 'HTTP/1.1 99 Apples in my Basket' in %sinfo002.php:%d + Stack trace: + #0 %sinfo002.php(%d): http\Message->__construct('HTTP/1.1 99 App...') +-#1 %sinfo002.php(%d): {closure}() ++#1 %sinfo002.php(%d): {closur%s}() + #2 %sinfo002.php(%d): trap(Object(Closure)) + #3 {main} + http\Exception\BadMessageException: http\Message::__construct(): Failed to parse headers: unexpected character '\040' at pos 7 of 'CONNECT HTTP/1.1' in %sinfo002.php:%d + Stack trace: + #0 %sinfo002.php(%d): http\Message->__construct('CONNECT HTTP/1....') +-#1 %sinfo002.php(%d): {closure}() ++#1 %sinfo002.php(%d): {closur%s}() + #2 %sinfo002.php(%d): trap(Object(Closure)) + #3 {main} + HTTP/1.1 200 diff --git a/php-pecl-http.spec b/php-pecl-http.spec index 5ecc929..793b4c2 100644 --- a/php-pecl-http.spec +++ b/php-pecl-http.spec @@ -51,7 +51,7 @@ Version: %{upstream_version}%{?upstream_prever:~%{upstream_lower}} Release: 0.10.%{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/%{proj_name}-%{upstream_version}%{?upstream_prever}.tgz %endif Summary: Extended HTTP support @@ -63,6 +63,7 @@ URL: https://pecl.php.net/package/pecl_http Source1: %{proj_name}.ini Patch0: %{proj_name}-build.patch +Patch1: %{proj_name}-php84.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -133,10 +134,11 @@ These are the files needed to compile programs using HTTP extension. mv NTS/package.xml . %endif -%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml} +sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml cd %{sources} %patch -P0 -p1 +%patch -P1 -p1 extver=$(sed -n '/#define PHP_PECL_HTTP_VERSION/{s/.* "//;s/".*$//;p}' php_http.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}%{?gh_date:dev}"; then @@ -279,28 +281,8 @@ TEST_PHP_ARGS="-n $modules -d extension=$PWD/../ZTS/modules/%{pecl_name}.so" \ %endif -%if 0%{?fedora} < 24 && 0%{?rhel} < 8 -# when pear installed alone, after us -%triggerin -- %{?scl_prefix}php-pear -if [ -x %{__pecl} ] ; then - %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -# posttrans as pear can be installed after us -%posttrans -if [ -x %{__pecl} ] ; then - %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -%postun -if [ $1 -eq 0 -a -x %{__pecl} ] ; then - %{pecl_uninstall} %{proj_name} >/dev/null || : -fi -%endif - - %files -%{?_licensedir:%license %{sources}/LICENSE} +%license %{sources}/LICENSE %doc %{pecl_docdir}/%{proj_name} %config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{pecl_name}.so @@ -321,6 +303,10 @@ fi %changelog +* Tue Jul 9 2024 Remi Collet <remi@remirepo.net> - 4.2.4-5 +- Fix build with PHP 8.4 using patch from + https://github.com/m6w6/ext-http/pull/135 + * Mon Jan 29 2024 Remi Collet <remi@remirepo.net> - 4.2.4-4 - Fix incompatible pointer types using patch from https://github.com/m6w6/ext-http/pull/134 |