nicolasff/phpredis — Issue #72: Run 'MULIT' method twice before 'EXEC', it will be wrong.
Author: cenyaozhong
Created: 2011-11-02 02:00:39+00:00
State: open

Hello.
As you let 'redis_sock.current' be null in 'MULIT' method in 'redis.c':
```
redis_sock->current = NULL;
```

And add a new fold_item as follow:
```
#define REDIS_SAVE_CALLBACK(callback, closure_context) IF_MULTI_OR_PIPELINE() { \
fold_item *f1 = malloc(sizeof(fold_item)); \
f1->fun = (void *)callback; \
f1->ctx = closure_context; \
f1->next = NULL; \
fold_item *current = redis_sock->current;\
if(current) current->next = f1; \
redis_sock->current = f1; \
if(NULL == redis_sock->head) { \
redis_sock->head = redis_sock->current;\
}\
}
```

If I run 'MULTI' and 'SET' twice before run 'EXEC', the 'redis_sock.head' will point to an old list's head, while the 'redis_sock.current' will point to a new list's tail. That will be wrong when I run 'EXEC'.