Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2017-06-16 16:51:56 +0300
committerPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2017-06-27 13:35:23 +0300
commit4a81e1a0f40f92d10daf3145a6bfee92149ba7d8 (patch)
tree40e3684c7fbaa4dbfe2af6127f688fc99db3d8fe
parentf8403d6c4df4b39818268eeb2a47c32308137248 (diff)
Issue #1199
Assume "NULL bulk" reply as success (empty session data).
-rw-r--r--redis_session.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/redis_session.c b/redis_session.c
index aa6434db..8a418e3d 100644
--- a/redis_session.c
+++ b/redis_session.c
@@ -670,17 +670,26 @@ PS_READ_FUNC(rediscluster) {
/* Attempt to read reply */
reply = cluster_read_resp(c TSRMLS_CC);
- if (!reply || c->err || reply->str == NULL) {
+ if (!reply || c->err) {
if (reply) cluster_free_reply(reply, 1);
return FAILURE;
}
/* Push reply value to caller */
#if (PHP_MAJOR_VERSION < 7)
- *val = reply->str;
- *vallen = reply->len;
+ if (reply->str == NULL) {
+ *val = STR_EMPTY_ALLOC();
+ *vallen = 0;
+ } else {
+ *val = reply->str;
+ *vallen = reply->len;
+ }
#else
- *val = zend_string_init(reply->str, reply->len, 0);
+ if (reply->str == NULL) {
+ *val = ZSTR_EMPTY_ALLOC();
+ } else {
+ *val = zend_string_init(reply->str, reply->len, 0);
+ }
#endif
/* Clean up */