diff options
author | Alberto Fernández <albertofem@gmail.com> | 2017-02-09 15:56:34 +0300 |
---|---|---|
committer | Pavlo Yatsukhnenko <yatsukhnenko@users.noreply.github.com> | 2017-02-09 15:56:34 +0300 |
commit | 058753e4c9da0b931a24b4f33b0c191187d817a1 (patch) | |
tree | 8374ff28ab9da88b9ea4b9dcf13cf01e2757f931 /cluster_library.c | |
parent | cddd610834c40a97f36c7fe9703ff11d6e23d53d (diff) |
Fix Null Bulk String response parsing in cluster library (#1104)
* Failing test case when running LUA with bulk empty response
* Fix issue when parsing bulk array response from eval commands
* Added test for bulk LUA responses and changed condition
* Added multi tests and fixes in C code format
Diffstat (limited to 'cluster_library.c')
-rw-r--r-- | cluster_library.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cluster_library.c b/cluster_library.c index 280d94bb..923dda4e 100644 --- a/cluster_library.c +++ b/cluster_library.c @@ -1870,7 +1870,11 @@ PHP_REDIS_API void cluster_variant_resp(INTERNAL_FUNCTION_PARAMETERS, redisClust RETVAL_TRUE; break; case TYPE_BULK: - RETVAL_STRINGL(r->str, r->len); + if (r->len < 0) { + RETVAL_NULL(); + } else { + RETVAL_STRINGL(r->str, r->len); + } break; case TYPE_MULTIBULK: array_init(z_arr); @@ -1896,8 +1900,12 @@ PHP_REDIS_API void cluster_variant_resp(INTERNAL_FUNCTION_PARAMETERS, redisClust add_next_index_bool(&c->multi_resp, 1); break; case TYPE_BULK: - add_next_index_stringl(&c->multi_resp, r->str, r->len); - efree(r->str); + if (r->len < 0) { + add_next_index_null(&c->multi_resp); + } else { + add_next_index_stringl(&c->multi_resp, r->str, r->len); + efree(r->str); + } break; case TYPE_MULTIBULK: cluster_mbulk_variant_resp(r, &c->multi_resp); |