[pkg-uWSGI-devel] Bug#933736: uwsgi-plugin-php: Please include "for php7 return failures only on failure"
Alexandre Rossi
niol at zincube.net
Fri Aug 2 18:03:42 BST 2019
Package: uwsgi-plugin-php
Version: 2.0.17.1+8+0.0.3+b3
Severity: normal
Tags: patch
Dear Maintainer,
I've noticed that an interesting fix for the uwsgi PHP plugin is not included
in the upstream releases[1].
This fix[2] solves failures to initialize PHP sessions using session_start()
for PHP apps that use the feature. I was hit by this with phpmyadmin,
adminer.
[1] https://github.com/unbit/uwsgi/issues/2048
[2] https://github.com/unbit/uwsgi/commit/7cf140aab8ed1f161c93f4c255964898560f2515
I rebuilt the uwsgi-src package with that patch included and then proceeded
to rebuilt uwsgi-plugin-php. This fixed thoses errors, for instance:
PHP Warning: session_start(): Failed to read session data: uwsgi (path: dbadmsessions) in /usr/share/adminer/adminer.php on line 71
I think that this is a nice candidate for stable-updates, I can help preparing
an upload if appropriate.
Thanks,
Alex
-- System Information:
Debian Release: bullseye/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.19.0-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8), LANGUAGE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages uwsgi-plugin-php depends on:
ii libc6 2.28-10
pn libphp-embed <none>
ii php7.3-cli [phpapi-20180731] 7.3.6-1
ii uwsgi-core [uwsgi-abi-a411bb8664cd85ae0fd852d2f665558a] 2.0.18-3
uwsgi-plugin-php recommends no packages.
uwsgi-plugin-php suggests no packages.
-------------- next part --------------
>From 7cf140aab8ed1f161c93f4c255964898560f2515 Mon Sep 17 00:00:00 2001
From: Krzysztof Warzecha <kwarzecha7 at gmail.com>
Date: Wed, 20 Sep 2017 14:31:36 +0200
Subject: [PATCH] plugins/php/session.c: for php7 return failures only on
failure
---
plugins/php/session.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/plugins/php/session.c b/plugins/php/session.c
index 2312b6b95..ddc375797 100644
--- a/plugins/php/session.c
+++ b/plugins/php/session.c
@@ -17,7 +17,10 @@ PS_READ_FUNC(uwsgi) {
#else
char *value = uwsgi_cache_magic_get((char *)key, strlen((char *)key), &valsize, NULL, cache);
#endif
- if (!value) return FAILURE;
+ if (!value) {
+ *val = STR_EMPTY_ALLOC();
+ return SUCCESS;
+ }
#ifdef UWSGI_PHP7
*val = zend_string_init(value, valsize, 0);
#else
@@ -48,6 +51,9 @@ PS_WRITE_FUNC(uwsgi) {
PS_DESTROY_FUNC(uwsgi) {
char *cache = PS_GET_MOD_DATA();
#ifdef UWSGI_PHP7
+ if (!uwsgi_cache_magic_exists(key->val, key->len, cache))
+ return SUCCESS;
+
if (!uwsgi_cache_magic_del(key->val, key->len, cache)) {
#else
if (!uwsgi_cache_magic_del((char *)key, strlen(key), cache)) {
More information about the pkg-uWSGI-devel
mailing list