8000 Allow for string based longs in zrangebyscore · jrtkcoder/phpredis@d9bd4e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit d9bd4e9

Browse files
Allow for string based longs in zrangebyscore
This works differently than the non-php7 version, as the zend library has now added explicit methods for conversions such as this, which handle more types (e.g. FALSE/NULL will equate to zero, and TRUE will equate to 1). However a non numeric string such as "not a number" will also equate to zero, but this seems to be the way it's intended to work. Fixes phpredis#906
1 parent a224ed3 commit d9bd4e9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

redis_commands.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,11 @@ int redis_zrangebyscore_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
537537
HashTable *ht_limit = Z_ARRVAL_P(z_ele);
538538
zval *z_off, *z_cnt;
539539
if((z_off = zend_hash_index_find(ht_limit,0)) != NULL &&
540-
(z_cnt = zend_hash_index_find(ht_limit,1)) != NULL &&
541-
Z_TYPE_P(z_off) == IS_LONG && Z_TYPE_P(z_cnt) == IS_LONG)
540+
(z_cnt = zend_hash_index_find(ht_limit,1)) != NULL)
542541
{
543542
has_limit = 1;
544-
limit_low = Z_LVAL_P(z_off);
545-
limit_high = Z_LVAL_P(z_cnt);
543+
limit_low = zval_get_long(z_off);
544+
limit_high = zval_get_long(z_cnt);
546545
}
547546
}
548547
}

0 commit comments

Comments
 (0)
0