summaryrefslogtreecommitdiffstats
path: root/redis-pr1063.patch
diff options
context:
space:
mode:
Diffstat (limited to 'redis-pr1063.patch')
-rw-r--r--redis-pr1063.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/redis-pr1063.patch b/redis-pr1063.patch
new file mode 100644
index 0000000..0c4d68d
--- /dev/null
+++ b/redis-pr1063.patch
@@ -0,0 +1,54 @@
+From 18c7ab007649f068075880984e59938b849b5ab5 Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Fri, 16 Dec 2016 15:29:05 +0100
+Subject: [PATCH] fix #1062 restore 3.0.0 session behavior for PHP 7.1
+
+---
+ redis_session.c | 23 +++++++++++++++++------
+ 1 file changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/redis_session.c b/redis_session.c
+index 6faae20..2ac2872 100644
+--- a/redis_session.c
++++ b/redis_session.c
+@@ -360,7 +360,7 @@ PS_READ_FUNC(redis)
+ resp = redis_session_key(rpm, key->val, key->len, &resp_len);
+ #endif
+ cmd_len = redis_cmd_format_static(&cmd, "GET", "s", resp, resp_len);
+-
++
+ efree(resp);
+ if(redis_sock_write(redis_sock, cmd, cmd_len TSRMLS_CC) < 0) {
+ efree(cmd);
+@@ -368,15 +368,26 @@ PS_READ_FUNC(redis)
+ }
+ efree(cmd);
+
+- /* read response */
+- if ((resp = redis_sock_read(redis_sock, &resp_len TSRMLS_CC)) == NULL) {
++ /* Read response from Redis. If we get a NULL response from redis_sock_read
++ * this can indicate an error, OR a "NULL bulk" reply (empty session data)
++ * in which case we can reply with success. */
++ if ((resp = redis_sock_read(redis_sock, &resp_len TSRMLS_CC)) == NULL && resp_len != -1) {
+ return FAILURE;
+ }
+ #if (PHP_MAJOR_VERSION < 7)
+- *val = resp;
+- *vallen = resp_len;
++ if (resp_len < 0) {
++ *val = STR_EMPTY_ALLOC();
++ *vallen = 0;
++ } else {
++ *val = resp;
++ *vallen = resp_len;
++ }
+ #else
+- *val = zend_string_init(resp, resp_len, 0);
++ if (resp_len < 0) {
++ *val = ZSTR_EMPTY_ALLOC();
++ } else {
++ *val = zend_string_init(resp, resp_len, 0);
++ }
+ efree(resp);
+ #endif
+