mirror of
https://github.com/php-win-ext/phpredis.git
synced 2026-03-24 00:52:16 +01:00
Cleanup rebase artifact and move msgpack to serializer section
This commit is contained in:
committed by
Pavlo Yatsukhnenko
parent
d5b8f83340
commit
545250f30b
@@ -11,15 +11,14 @@ PHP_ARG_ENABLE(redis-session, whether to disable sessions,
|
||||
PHP_ARG_ENABLE(redis-igbinary, whether to enable igbinary serializer support,
|
||||
[ --enable-redis-igbinary Enable igbinary serializer support], no, no)
|
||||
|
||||
PHP_ARG_ENABLE(redis-msgpack, whether to enable msgpack serializer support,
|
||||
[ --enable-redis-msgpack Enable msgpack serializer support], no, no)
|
||||
|
||||
PHP_ARG_ENABLE(redis-lzf, whether to enable lzf compression,
|
||||
[ --enable-redis-lzf Enable lzf compression support], no, no)
|
||||
|
||||
PHP_ARG_WITH(liblzf, use system liblzf,
|
||||
[ --with-liblzf[=DIR] Use system liblzf], no, no)
|
||||
[ --enable-redis-igbinary Enable igbinary serializer support], no, no)
|
||||
|
||||
PHP_ARG_ENABLE(redis-msgpack, whether to enable msgpack serializer support,
|
||||
[ --enable-redis-msgpack Enable msgpack serializer support], no, no)
|
||||
|
||||
if test "$PHP_REDIS" != "no"; then
|
||||
|
||||
|
||||
61
library.c
61
library.c
@@ -1914,67 +1914,6 @@ PHP_REDIS_API int redis_sock_read_multibulk_reply(INTERNAL_FUNCTION_PARAMETERS,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* redis_sock_read_multibulk_reply_vals
|
||||
*
|
||||
* This is identical to redis_sock_read_multibulk_reply except that it unserializes vals only, rather than rely on
|
||||
* the chosen unserializer to silently return 0 after a failed attempt (which msgpack does not do).
|
||||
*
|
||||
* Perhaps not the optimal solution, but the easiest way to resolve the problem of failed attempts to
|
||||
* unserialize a key that hadn't been serialized to begin with in blpop, brpop.
|
||||
*
|
||||
*/
|
||||
PHP_REDIS_API int redis_sock_read_multibulk_reply_vals(INTERNAL_FUNCTION_PARAMETERS,
|
||||
RedisSock *redis_sock, zval *z_tab,
|
||||
void *ctx)
|
||||
{
|
||||
char inbuf[1024];
|
||||
int numElems, err_len;
|
||||
|
||||
if(-1 == redis_check_eof(redis_sock, 0 TSRMLS_CC)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(php_stream_gets(redis_sock->stream, inbuf, 1024) == NULL) {
|
||||
REDIS_STREAM_CLOSE_MARK_FAILED(redis_sock);
|
||||
zend_throw_exception(redis_exception_ce, "read error on connection", 0
|
||||
TSRMLS_CC);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(inbuf[0] != '*') {
|
||||
IF_MULTI_OR_PIPELINE() {
|
||||
add_next_index_bool(z_tab, 0);
|
||||
} else {
|
||||
if (inbuf[0] == '-') {
|
||||
err_len = strlen(inbuf+1) - 2;
|
||||
redis_sock_set_err(redis_sock, inbuf+1, err_len);
|
||||
}
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
numElems = atoi(inbuf+1);
|
||||
zval zv, *z_multi_result = &zv;
|
||||
#if (PHP_MAJOR_VERSION < 7)
|
||||
MAKE_STD_ZVAL(z_multi_result);
|
||||
#endif
|
||||
array_init(z_multi_result); /* pre-allocate array for multi's results. */
|
||||
|
||||
redis_mbulk_reply_loop(INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock,
|
||||
z_multi_result, numElems, UNSERIALIZE_VALS);
|
||||
|
||||
IF_MULTI_OR_PIPELINE() {
|
||||
add_next_index_zval(z_tab, z_multi_result);
|
||||
} else {
|
||||
RETVAL_ZVAL(z_multi_result, 0, 1);
|
||||
}
|
||||
/*zval_copy_ctor(return_value); */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Like multibulk reply, but don't touch the values, they won't be unserialized
|
||||
* (this is used by HKEYS). */
|
||||
PHP_REDIS_API int
|
||||
|
||||
Reference in New Issue
Block a user