Sitelet https://github.com/phpredis/phpredis/commit/4a81e1
Skip to content

Commit 4a81e1a

Browse files
committed
Issue #1199
Assume "NULL bulk" reply as success (empty session data).
1 parent f8403d6 commit 4a81e1a

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

‎redis_session.c‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -670,17 +670,26 @@ PS_READ_FUNC(rediscluster) {
670670

671671
/* Attempt to read reply */
672672
reply = cluster_read_resp(c TSRMLS_CC);
673-
if (!reply || c->err || reply->str == NULL) {
673+
if (!reply || c->err) {
674674
if (reply) cluster_free_reply(reply, 1);
675675
return FAILURE;
676676
}
677677

678678
/* Push reply value to caller */
679679
#if (PHP_MAJOR_VERSION < 7)
680-
*val = reply->str;
681-
*vallen = reply->len;
680+
if (reply->str == NULL) {
681+
*val = STR_EMPTY_ALLOC();
682+
*vallen = 0;
683+
} else {
684+
*val = reply->str;
685+
*vallen = reply->len;
686+
}
682687
#else
683-
*val = zend_string_init(reply->str, reply->len, 0);
688+
if (reply->str == NULL) {
689+
*val = ZSTR_EMPTY_ALLOC();
690+
} else {
691+
*val = zend_string_init(reply->str, reply->len, 0);
692+
}
684693
#endif
685694

686695
/* Clean up */

0 commit comments

Comments
 (0)