summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2023-09-04 13:30:55 +0200
committerRemi Collet <remi@php.net>2023-09-04 13:30:55 +0200
commitf248ae8e4297fa01e13b12289d3d280f9a8e45c5 (patch)
tree2c2757e26ad2213934af7d76f0c2d172c3f709c4
parent842be679f665ec048b8e5337d804c7c5a4fb9669 (diff)
add patch for PHP 8.3 from
https://github.com/unbit/uwsgi/pull/2559
-rw-r--r--.gitignore2
-rw-r--r--uwsgi-plugin-php.spec23
-rw-r--r--uwsgi_fix_php83.patch60
3 files changed, 78 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 1ab5c4f..01f0400 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
+clog
package-*.xml
*.tgz
+*.tar.bz2
*.tar.gz
*.tar.xz
*.tar.xz.asc
diff --git a/uwsgi-plugin-php.spec b/uwsgi-plugin-php.spec
index 27ea16b..dce61f2 100644
--- a/uwsgi-plugin-php.spec
+++ b/uwsgi-plugin-php.spec
@@ -1,7 +1,7 @@
# remirepo/fedora spec file for uwsgi-plugin-php
#
-# Copyright (c) 2017-2022 Remi Collet
-# License: CC-BY-SA
+# Copyright (c) 2017-2023 Remi Collet
+# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
@@ -29,16 +29,18 @@ Requires: %{scl_prefix}php-embedded
Name: %{?scl_prefix}%{project}-plugin-php
Version: 2.0.21
-Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Summary: uWSGI - Plugin for PHP support
-License: GPLv2 with exceptions
+License: GPL-2.0-only with exceptions
URL: http://projects.unbit.it/uwsgi
Source0: http://projects.unbit.it/downloads/%{project}-%{version}.tar.gz
# https://github.com/unbit/uwsgi/issues/2283
Patch1: uwsgi_fix_php8.patch
-Patch4: uwsgi_fix_php82.patch
+Patch2: uwsgi_fix_php82.patch
+# https://github.com/unbit/uwsgi/pull/2559
+Patch3: uwsgi_fix_php83.patch
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7.0
@@ -68,8 +70,11 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
%prep
%setup -qn %{project}-%{version}
-%patch1 -p1
-%patch4 -p1
+%patch -P1 -p1
+%patch -P2 -p1
+%if "%{php_version}" > "8.3"
+%patch -P3 -p1
+%endif
# Fix makefile
sed -e 's:/lib:/%{_lib}:' -i plugins/php/uwsgiplugin.py
@@ -96,6 +101,10 @@ install -Dpm 755 %{?scl}%{!?scl:php}_plugin.so %{buildroot}%{_root_libdir}/%{pro
%changelog
+* Mon Sep 4 2023 Remi Collet <remi@remirepo.net> - 2.0.21-2
+- add patch for PHP 8.3 from
+ https://github.com/unbit/uwsgi/pull/2559
+
* Fri Nov 4 2022 Remi Collet <remi@remirepo.net> - 2.0.21-1
- update to 2.0.21
diff --git a/uwsgi_fix_php83.patch b/uwsgi_fix_php83.patch
new file mode 100644
index 0000000..156921b
--- /dev/null
+++ b/uwsgi_fix_php83.patch
@@ -0,0 +1,60 @@
+From 15df465bcb3a2725209f7ac261c5eeacd90ad672 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 4 Sep 2023 13:10:52 +0200
+Subject: [PATCH] ini_entries is read-only PHP 8.3
+
+---
+ plugins/php/php_plugin.c | 25 ++++++++++++++++++-------
+ 1 file changed, 18 insertions(+), 7 deletions(-)
+
+diff --git a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c
+index b3efa006a..e0ead46ab 100644
+--- a/plugins/php/php_plugin.c
++++ b/plugins/php/php_plugin.c
+@@ -27,6 +27,7 @@ struct uwsgi_php {
+ char *fallback;
+ char *fallback2;
+ char *fallback_qs;
++ char *ini_entries;
+ size_t ini_size;
+ int dump_config;
+ char *server_software;
+@@ -232,21 +233,31 @@ static sapi_module_struct uwsgi_sapi_module;
+
+ void uwsgi_php_append_config(char *filename) {
+ size_t file_size = 0;
+- char *file_content = uwsgi_open_and_read(filename, &file_size, 1, NULL);
+- uwsgi_sapi_module.ini_entries = realloc(uwsgi_sapi_module.ini_entries, uphp.ini_size + file_size);
+- memcpy(uwsgi_sapi_module.ini_entries + uphp.ini_size, file_content, file_size);
++ char *file_content = uwsgi_open_and_read(filename, &file_size, 1, NULL);
++ if (uphp.ini_size) {
++ uphp.ini_entries = realloc(uphp.ini_entries, uphp.ini_size + file_size);
++ } else {
++ uphp.ini_entries = malloc(file_size);
++ }
++ memcpy(uphp.ini_entries + uphp.ini_size, file_content, file_size);
+ uphp.ini_size += file_size-1;
+ free(file_content);
++ uwsgi_sapi_module.ini_entries = uphp.ini_entries;
+ }
+
+ void uwsgi_php_set(char *opt) {
+
+- uwsgi_sapi_module.ini_entries = realloc(uwsgi_sapi_module.ini_entries, uphp.ini_size + strlen(opt)+2);
+- memcpy(uwsgi_sapi_module.ini_entries + uphp.ini_size, opt, strlen(opt));
++ if (uphp.ini_size) {
++ uphp.ini_entries = realloc(uphp.ini_entries, uphp.ini_size + strlen(opt)+2);
++ } else {
++ uphp.ini_entries = malloc(strlen(opt)+2);
++ }
++ memcpy(uphp.ini_entries + uphp.ini_size, opt, strlen(opt));
+
+ uphp.ini_size += strlen(opt)+1;
+- uwsgi_sapi_module.ini_entries[uphp.ini_size-1] = '\n';
+- uwsgi_sapi_module.ini_entries[uphp.ini_size] = 0;
++ uphp.ini_entries[uphp.ini_size-1] = '\n';
++ uphp.ini_entries[uphp.ini_size] = 0;
++ uwsgi_sapi_module.ini_entries = uphp.ini_entries;
+ }
+
+ extern ps_module ps_mod_uwsgi;