Skip to content

Commit e5bdf71

Browse files
committed
PUBLISH/SUBSCRIBE crashes.
1 parent 8b7de81 commit e5bdf71

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

README.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ $redis->delete('key1', 'key2'); /* return 2 */
142142
$redis->delete(array('key3', 'key4')); /* return 2 */
143143
</pre>
144144

145-
## multi, exec.
145+
## multi, exec, discard.
146146
##### Description
147147
Enter and exit transactional mode.
148148
##### Parameters
149-
(optional) `Redis::MULTI` or `Redis::PIPELINE`. Defaults to `Redis::MULTI`. A `Redis::MULTI` block of commands runs as a single transaction; a `Redis::PIPELINE` block is simply transmitted faster to the server, but without any guarantee of atomicity.
149+
(optional) `Redis::MULTI` or `Redis::PIPELINE`. Defaults to `Redis::MULTI`. A `Redis::MULTI` block of commands runs as a single transaction; a `Redis::PIPELINE` block is simply transmitted faster to the server, but without any guarantee of atomicity. `discard` cancels a transaction.
150150
##### Return value
151151
`multi()` returns the Redis instance and enters multi-mode. Once in multi-mode, all subsequent method calls return the same object until `exec()` is called.
152152
##### Example

redis.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3970,8 +3970,7 @@ PHP_METHOD(Redis, multi)
39703970
if(multi_value == REDIS_MULTI || multi_value == REDIS_PIPELINE) {
39713971
set_flag(object, multi_value);
39723972
} else {
3973-
/* php_printf("error[%f] !! \n", multi_value); */
3974-
exit(-1);
3973+
RETURN_FALSE;
39753974
}
39763975

39773976
current = NULL;
@@ -4394,7 +4393,7 @@ PHP_METHOD(Redis, subscribe)
43944393
redis_sock TSRMLS_CC);
43954394
zval **type, **channel, **data;
43964395

4397-
if(Z_TYPE_P(z_tab) == IS_NULL) {
4396+
if(Z_TYPE_P(z_tab) != IS_ARRAY) {
43984397
//ERROR
43994398
break;
44004399
}
@@ -4468,7 +4467,7 @@ PHP_METHOD(Redis, subscribe)
44684467
* response format :
44694468
* array(
44704469
* channel_0 => TRUE|FALSE,
4471-
* channel_1 => TRUE_FALSE,
4470+
* channel_1 => TRUE|FALSE,
44724471
* ...
44734472
* channel_n => TRUE|FALSE
44744473
* );

0 commit comments

Comments
 (0)