From 6e5d7189a9e051f5ead5082ada51c876e99bac74 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 17 Oct 2022 16:45:29 +0200 Subject: add upstream patch for PHP 8.2 --- uwsgi-plugin-php.spec | 7 ++++++- uwsgi_fix_php81.patch | 42 ++++++++++++++++++++++++++++++++++++++++++ uwsgi_fix_php82.patch | 15 +++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 uwsgi_fix_php81.patch create mode 100644 uwsgi_fix_php82.patch diff --git a/uwsgi-plugin-php.spec b/uwsgi-plugin-php.spec index 20acc1b..acc0da1 100644 --- a/uwsgi-plugin-php.spec +++ b/uwsgi-plugin-php.spec @@ -29,7 +29,7 @@ Requires: %{scl_prefix}php-embedded Name: %{?scl_prefix}%{project}-plugin-php Version: 2.0.20 -Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Summary: uWSGI - Plugin for PHP support License: GPLv2 with exceptions URL: http://projects.unbit.it/uwsgi @@ -42,6 +42,7 @@ Patch1: uwsgi_fix_php8.patch Patch2: uwsgi_fix_php_arginfo.patch # https://github.com/unbit/uwsgi/issues/2394 Patch3: uwsgi_fix_php81.patch +Patch4: uwsgi_fix_php82.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7.0 @@ -98,6 +99,7 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 # Fix makefile sed -e 's:/lib:/%{_lib}:' -i plugins/php/uwsgiplugin.py @@ -124,6 +126,9 @@ install -Dpm 755 %{?scl}%{!?scl:php}_plugin.so %{buildroot}%{_root_libdir}/%{pro %changelog +* Mon Oct 17 2022 Remi Collet - 2.0.20-3 +- add upstream patch for PHP 8.2 + * Thu Jun 9 2022 Remi Collet - 2.0.20-2 - add upstream patch for PHP 8.1 diff --git a/uwsgi_fix_php81.patch b/uwsgi_fix_php81.patch new file mode 100644 index 0000000..81d9025 --- /dev/null +++ b/uwsgi_fix_php81.patch @@ -0,0 +1,42 @@ +From 8ca18da9a01eee19156243c5c0d28d2572698e4a Mon Sep 17 00:00:00 2001 +From: Riccardo Magliocchetti +Date: Sun, 30 Jan 2022 14:31:50 +0100 +Subject: [PATCH] plugins/php: handle php8.1 zend_file_handle signature change + +filename is now a zend_string. + +Refs #2394 +--- + plugins/php/php_plugin.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +diff --git a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c +index d336adddc..8b5a24156 100644 +--- a/plugins/php/php_plugin.c ++++ b/plugins/php/php_plugin.c +@@ -1096,14 +1096,19 @@ int uwsgi_php_request(struct wsgi_request *wsgi_req) { + + SG(request_info).path_translated = wsgi_req->file; + +- memset(&file_handle, 0, sizeof(zend_file_handle)); +- file_handle.type = ZEND_HANDLE_FILENAME; +- file_handle.filename = real_filename; ++#if PHP_VERSION_ID >= 80100 ++ zend_string *handle_filename = zend_string_init(real_filename, real_filename_len, 0); ++#else ++ const char *handle_filename = real_filename; ++#endif ++ memset(&file_handle, 0, sizeof(zend_file_handle)); ++ file_handle.type = ZEND_HANDLE_FILENAME; ++ file_handle.filename = handle_filename; + +- if (php_request_startup() == FAILURE) { ++ if (php_request_startup() == FAILURE) { + uwsgi_500(wsgi_req); +- return -1; +- } ++ return -1; ++ } + + struct uwsgi_string_list *usl=NULL; + diff --git a/uwsgi_fix_php82.patch b/uwsgi_fix_php82.patch new file mode 100644 index 0000000..66a8e49 --- /dev/null +++ b/uwsgi_fix_php82.patch @@ -0,0 +1,15 @@ +diff -uNr a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c +--- a/plugins/php/php_plugin.c 2022-10-06 19:52:07.237882916 +0200 ++++ b/plugins/php/php_plugin.c 2022-10-06 19:56:29.232418542 +0200 +@@ -607,7 +607,11 @@ + static int php_uwsgi_startup(sapi_module_struct *sapi_module) + { + ++#if PHP_VERSION_ID >= 80200 ++ if (php_module_startup(&uwsgi_sapi_module, &uwsgi_module_entry)==FAILURE) { ++#else + if (php_module_startup(&uwsgi_sapi_module, &uwsgi_module_entry, 1)==FAILURE) { ++#endif + return FAILURE; + } else { + return SUCCESS; -- cgit