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:
authorNicolas Favre-Felix <n.favrefelix@gmail.com>2012-09-09 23:38:30 +0400
committerNicolas Favre-Felix <n.favrefelix@gmail.com>2012-09-09 23:38:30 +0400
commit6153477c4f71cbfadaae628e47ea022136f0131f (patch)
tree8eb1566c811254ded1ef29bdc7dd475d2a0dadcd /library.c
parent9eb217c061dbc60609f426b6fc365e0c3ef0580c (diff)
Extend getLastError to all calls
Fixes GitHub issue #245.
Diffstat (limited to 'library.c')
-rw-r--r--library.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/library.c b/library.c
index 25b1d3aa..6a93f490 100644
--- a/library.c
+++ b/library.c
@@ -172,6 +172,7 @@ PHPAPI char *redis_sock_read(RedisSock *redis_sock, int *buf_len TSRMLS_DC)
{
char inbuf[1024];
char *resp = NULL;
+ size_t err_len;
if(-1 == redis_check_eof(redis_sock TSRMLS_CC)) {
return NULL;
@@ -189,6 +190,8 @@ PHPAPI char *redis_sock_read(RedisSock *redis_sock, int *buf_len TSRMLS_DC)
switch(inbuf[0]) {
case '-':
+ err_len = strlen(inbuf+1) - 2;
+ redis_sock_set_err(redis_sock, inbuf+1, err_len);
/* stale data */
if(memcmp(inbuf + 1, "-ERR SYNC ", 10) == 0) {
zend_throw_exception(redis_exception_ce, "SYNC with master in progress", 0 TSRMLS_CC);