Commit 78c4ab53 authored by Alexandre Rossi's avatar Alexandre Rossi

PHP plugin: fix PHP7 sessions (Closes: #933736)

parent f149fecc
From 7cf140aab8ed1f161c93f4c255964898560f2515 Mon Sep 17 00:00:00 2001
From: Krzysztof Warzecha <kwarzecha7@gmail.com>
Date: Wed, 20 Sep 2017 14:31:36 +0200
Subject: [PATCH] plugins/php/session.c: for php7 return failures only on
failure
upstream seems to have forgotten to apply this on the wusgi-2.0 branch.
This led to PHP application failing to initialize PHP sessions.
Forwarded: https://github.com/unbit/uwsgi/issues/2048
Applied-Upstream: https://github.com/unbit/uwsgi/commit/7cf140aab8ed1f161c93f4c255964898560f2515
---
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)) {
0001-php7-sessions-fix
1001_avoid_setting_RPATH.patch
1002_fix-reload-process-name.patch
1003_remove-php-libs.patch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment