Skip to content

Commit

Permalink
Issue #1199
Browse files Browse the repository at this point in the history
Assume "NULL bulk" reply as success (empty session data).
  • Loading branch information
yatsukhnenko committed Jun 16, 2017
1 parent 0d69650 commit 659450a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions redis_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 659450a

Please sign in to comment.