144 Commits

Author SHA1 Message Date
Michael Grunder
d938a42621 Fix LZF decompression logic. (#2065)
* Fix LZF decompression logic.

Rework how we decompress LZF data.  Previously it was possible to
encounter a double-free, if the error was not E2BIG.

* .
2022-02-01 20:05:36 +02:00
Michael Grunder
1666a071b1 Fix expire check in testttl (#2039)
The previous logic was timing related and also kind of testing Redis'
expiration logic itself.
2021-12-07 14:19:33 -08:00
michael-grunder
ffcdbbf1e5 Rebase fixes 2021-10-06 12:56:42 -07:00
Nathaniel Braun
732eb8dcbe Add documentation for backoff algorithms 2021-10-05 14:34:58 -07:00
Nathaniel Braun
05129c3a3d Add support for exponential backoff on retry 2021-10-05 14:34:53 -07:00
michael-grunder
da2790aec5 Separate compression and create utility methods
This commit splits compression and serialization into two distinct parts
and adds some utility functions so the user can compress/uncompress
or pack/unpack data explicily.

See #1939
2021-10-05 14:32:16 -07:00
michael-grunder
ab25ae7f39 Fix PhpRedis session tests to soften timing issues
Rework the session locking unit tests to be less reliant on arbitrary
sleep calls which can be very troublesome when running in Travis and
especially when running in Travis under valgrind.

Additionally, skip multiple newly added Redis 6.2 commands that aren't
yet implemented in RedisCluster.
2021-10-05 14:32:11 -07:00
Pavlo Yatsukhnenko
a43f4586ef TravisCI: fix tests 2021-10-05 14:31:13 -07:00
Pavlo Yatsukhnenko
ed283e1ab6 Fix Redis::sMisMember. 2021-10-05 14:29:41 -07:00
Pavlo Yatsukhnenko
ae23824720 [WIP] Issue #1894
Add Redis::sMisMember command.
2021-10-05 14:29:41 -07:00
michael-grunder
e67e1a1674 More Travis-CI fixes 2021-03-23 17:33:56 -07:00
michael-grunder
4b1394418e Fix PhpRedis session tests to soften timing issues
Rework the session locking unit tests to be less reliant on arbitrary
sleep calls which can be very troublesome when running in Travis and
especially when running in Travis under valgrind.
2021-03-23 13:09:52 -07:00
michael-grunder
c48b3a2ba3 Fix ZSTD decompression on bad data.
ZSTD uses two defined error numbers to inform the caller when the
compressed data is invalid (e.g. wrong magic number) or the size is
unknown.

We should always know the size so abort if ZSTD returns either to us.

Fixes: #1936
2021-03-22 10:48:27 -07:00
Adam Olley
edc724e602 Pass compression flag when performing HMGET (#1945)
Without this, performing a HMGET call fails to decompress the data before
returning it to php.
2021-03-22 10:48:10 -07:00
Michael Grunder
514bc37102 Verify SET options are strings before testing them as strings. (#1859)
Addresses #1835
2020-10-13 13:05:20 -07:00
Michael Grunder
950e8de807 Issue.1847 cluster segfault (#1850)
Fix for #1847 when dealing with NULL multi bulk replies in RedisCluster.

Adds `Redis::OPT_NULL_MULTIBULK_AS_NULL` setting to have PhpRedis
treat NULL multi bulk replies as `NULL` instead of `[]`.

Co-authored-by: Alex Offshore <offshore@aopdg.ru>
2020-09-28 11:07:46 -07:00
Remi Collet
f4a30cb2bd fix 1 test for PHP 8, use call_user_func when no arg 2020-09-11 09:37:11 +02:00
Michael Grunder
3645807188 Relax requirements on set's expire argument (#1830)
Relax requirements on set's expire argument

See: #1783
2020-08-30 13:51:12 -07:00
michael-grunder
566fdeeb19 Add a regression test for XINFO on empty stream 2020-08-28 10:03:38 -07:00
michael-grunder
14ac969da2 Add a test for passing NULL to auth 2020-07-07 10:43:31 -07:00
Michael Grunder
a311cc4ec3 Support for Redis 6 ACLs (#1791)
Add support for Redis 6 ACLs in the `Redis`, `RedisCluster`, and `RedisArray` classes.

On a related note, it adds a mechanism for users to customize how we generate persistent connection IDs such that they can be grouped in different ways depending on the specific use case required (e.g. it would allow connections to be grouped by username, or by user-defined persistent_id, or both).
2020-06-24 17:00:01 -07:00
Michael Grunder
04def9fbe2 Rebased LZ4 PR (#1781)
LZ4 compression by @iliaal
2020-06-07 14:09:30 -07:00
Michael Grunder
a0c53e0b30 Issue.1762 xinfo full (#1771)
Add support for `XINFO STREAM FULL [COUNT]`
2020-06-07 13:48:06 -07:00
Pavlo Yatsukhnenko
890ee0e656 TravisCI: test tls connect 2020-06-05 09:40:53 +03:00
Michael Grunder
f9c7bb5788 Adds Redis 6.0 KEEPTTL option for SET (#1766)
Added support for KEEPTTL option of SET command, which added in Redis 6

See: #1761

Co-authored-by: victor <viktork@sekindo.com>
2020-05-23 14:25:41 -07:00
Pavlo Yatsukhnenko
e80600e244 Issue #548 (#1649)
Adds `Redis::SCAN_PREFIX` and `Redis::SCAN_NOPREFIX` as options to SCAN.

See #548
2020-05-18 18:11:40 -07:00
Michael Grunder
201a975999 Make unit test authentication configurable (#1748)
Right now cloning the repo and running unit tests will all fail if the
Redis/RedisCluster instances aren't configured with the password
'phpredis'.

This commit simply makes authentication during the tests optional via a
command-line argument.
2020-04-30 21:22:40 -07:00
Pavlo Yatsukhnenko
e37f38a39e requirepass 2020-03-30 13:32:27 +03:00
Pavlo Yatsukhnenko
7e4c7b3e69 Change version_compare usage in tests 2020-03-09 14:19:26 +02:00
Michael Grunder
0ce7ca2fb1 Issue.1714 json session tests (#1717)
* Add json.so as well if we don't find it.

See #1714

* Remove added newline
2020-03-02 11:03:51 -08:00
michael-grunder
b1724b8482 Use proper version compare 2020-02-06 14:01:52 -08:00
michael-grunder
53fb36c9d3 Remove additional TYPE test 2020-02-06 14:01:52 -08:00
michael-grunder
544e641bf2 Adds a test for #1646
NOTE:  [This
comment](https://github.com/antirez/redis/pull/6116#issuecomment-509331565)
indicates the feature may be backported to Redis 5, so we'll want to
change our unit test if that happens.
2020-02-06 14:01:52 -08:00
michael-grunder
c3d83d4460 Create a specific exception for 'test skipped'
I our test suite we were only checking if an exception was an instance
of `RedisException` and marking the test 'SKIPPED' if not.  This was
masking a failure in the RedisCluster test for testMultiExec by showing
it as skipped when it was actually throwing an exception (not being able
to execute the MULTI across the cluster).
2020-01-21 10:07:00 -08:00
michael-grunder
9f4ededa41 Tests for unix socket and high ports
Adds some tests to protect against regressions when connecting to unix
sockets and high ports.
2019-11-04 17:21:55 -08:00
Remi Collet
2abc61da31 Add support for Zstd compression 2019-07-09 10:00:40 +02:00
Pavlo Yatsukhnenko
235a27e7c0 Issue #1577
Remove checking of version of msgpack.
Allow to disable json serializer.
Fix tests.
2019-06-21 11:55:13 -07:00
michael-grunder
95c8aab9df Soft deprecate methods that aren't actually Redis commands.
Addresses #1168
2019-06-16 15:58:00 -07:00
michael-grunder
19e47b4b32 Revert to using PHP's time 2019-06-16 11:44:49 -07:00
michael-grunder
9a699e5308 Try to give the EXPIREAT test a bit more leeway to succeed. 2019-06-16 11:38:45 -07:00
Pavlo Yatsukhnenko
4852a5106a xInfo response format 2019-06-12 12:20:38 +03:00
michael-grunder
0c17bd27a0 Make the XREADGROUP optional COUNT and BLOCK arguments nullable.
Change the way we accept COUNT and BLOCK such that a user can pass NULL
to mean "no value".  This is technically a breaking change, since
previously the value `-1` was used for "no value".

Fixes #1560
2019-06-04 13:37:52 -07:00
michael-grunder
6e49417068 Allow PING to take an optional argument.
Addresses #1563
2019-06-03 07:53:21 -07:00
Michael Grunder
19f3efcfe6 Issue.1555 zrange withscores arg (#1565)
Allows ZRANGE to be called either with `true` or `['withscores' => true]` so it's consistent with `ZRANGEBYSCORE` but also backward compatible.

Fixes #1555
2019-06-02 17:44:26 -07:00
michael-grunder
5cb30fb2a6 Adds OPT_REPLY_LITERAL for rawCommand and EVAL
Adds an option to process the actual strings in simple string replies as
opposed to translating them to `true`.  This only applies to
`rawCommand` and `eval` because as far as I know know vanilla Redis
command attaches any information besides `OK` to simple string replies.

Addresses #1550
2019-05-13 09:38:18 -07:00
Pavlo Yatsukhnenko
98bd2886c3 JSON serializer 2019-05-12 15:30:47 +03:00
michael-grunder
d7450b2f59 Add support for STREAM to the type command 2019-04-16 08:16:12 -07:00
B. Gortney
d5b8f83340 rebase msgpack pull request (#801) on develop branch 2019-03-23 16:55:43 +02:00
michael-grunder
eb81b9153c Merge branch 'issue-1509' into issue.1448-require_php7 2019-02-23 17:41:19 -08:00
michael-grunder
f89e941a88 Change ZPOP* return type and implement blocking variants
This commit updates ZPOPMIN/ZPOPMAX to return the same format that
zRange WITHSCORES and zRangeByScore WITHSCORES does.

In addition the blocking variants BZPOPMIN and BZPOPMAX are implemented.
2019-02-18 20:00:08 -08:00