Skip to content

Commit a5783b2

Browse files
Merge tag '5.3.0' into develop
phpredis 5.3.0 This release contains initial support for Redis 6 ACLs, LZ4 compression, and many more fixes and improvements. You can find a detailed list of changes in Changelog.md and package.xml A special thanks to BlueHost for sponsoring ACL support \o/ * Sponsors ~ Audiomack - https://audiomack.com ~ BlueHost - https://bluehost.com ~ Redis Cache Pro for WordPress - https://wprediscache.com ~ Avtandil Kikabidze - https://github.com/akalongman
2 parents 73cf2e3 + adbc12e commit a5783b2

File tree

7 files changed

+328
-60
lines changed

7 files changed

+328
-60
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ addons:
3030
packages:
3131
- clang
3232
- libzstd1-dev
33+
- liblz4-dev
34+
- pkg-config
3335
- valgrind
3436
- stunnel
3537
before_install:
3638
- phpize
37-
- CFGARGS="--enable-redis-lzf --enable-redis-zstd"
39+
- CFGARGS="--enable-redis-lzf --enable-redis-zstd --enable-redis-lz4 --with-liblz4"
3840
- pecl install igbinary && CFGARGS="$CFGARGS --enable-redis-igbinary"
3941
- pecl install msgpack && CFGARGS="$CFGARGS --enable-redis-msgpack"
4042
- ./configure $CFGARGS

Changelog.md

Lines changed: 139 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,156 @@ All changes to phpredis will be documented in this file.
55
We're basing this format on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and PhpRedis adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## [5.3.0] - 2020-06-30 ([GitHub](https://github.com/phpredis/phpredis/releases/tag/5.3.0), [PECL](https://pecl.php.net/package/redis/5.3.0))
9+
10+
### Sponsors :sparkling_heart:
11+
12+
- [Audiomack](https://audiomack.com)
13+
- [BlueHost](https://bluehost.com)
14+
- [Redis Cache Pro for WordPress](https://wprediscache.com)
15+
- [Avtandil Kikabidze](https://github.com/akalongman)
16+
17+
*There were no changes between 5.3.0RC2 and 5.3.0*
18+
19+
## [5.3.0RC2] - 2020-06-26 ([GitHub](https://github.com/phpredis/phpredis/releases/tag/5.3.0RC2), [PECL](https://pecl.php.net/package/redis/5.3.0RC2))
20+
21+
### Sponsors :sparkling_heart:
22+
23+
- [Audiomack](https://audiomack.com)
24+
- [BlueHost](https://bluehost.com)
25+
- [Redis Cache Pro for WordPress](https://wprediscache.com/)
26+
- [Avtandil Kikabidze](https://github.com/akalongman)
27+
28+
### Fixed
29+
30+
- Fix LZ4 configuration and use pkg-config if we have it
31+
[df398cb0](https://github.com/phpredis/phpredis/commit/df398cb07cd10d870c6805d5834703dc39590b0f)
32+
([Remi Collet](https://github.com/remicollet))
33+
34+
- Make sure persistent pool ID is NULL terminated
35+
[0838b5bd](https://github.com/phpredis/phpredis/commit/0838b5bde7ef25d419868c7e705bf6c70d68ea20),
36+
[57bb95bf](https://github.com/phpredis/phpredis/commit/57bb95bf5a01a2adb74e2bf73bb285488e0d1586)
37+
([Michael Grunder](https://github.com/michael-grunder))
38+
39+
### Changed
40+
41+
- Run LZ4 tests in Travis
42+
[3ba3f06d](https://github.com/phpredis/phpredis/commit/3ba3f06d51ff126eb51dd697381c0e56b38bbcf3)
43+
([Michael Grunder](https://github.com/michael-grunder))
44+
45+
## [5.3.0RC1]
946

1047
### Sponsors :sparkling_heart:
1148

1249
- [Audiomack.com](https://audiomack.com)
13-
- [Till Krüss](https://github.com/tillkruss)
50+
- [BlueHost](https://bluehost.com)
51+
- [Redis Cache Pro for WordPress](https://wprediscache.com/)
52+
- [Avtandil Kikabidze](https://github.com/akalongman)
53+
54+
### Added
55+
56+
- Support for Redis 6 ACLs
57+
[a311cc4e](https://github.com/phpredis/phpredis/commit/a311cc4ec3cecdbaf83ba66985efa82137e37cc0)
58+
([Michael Grunder](https://github.com/michael-grunder))
59+
60+
- LZ4 Compression
61+
[04def9fb](https://github.com/phpredis/phpredis/commit/04def9fbe2194b3b711362de57260a6cd5216e69)
62+
([Ilia Alshanetsky](https://github.com/iliaal),
63+
[Michael Grunder](https://github.com/michael-grunder))
64+
65+
- Support for new Redis 6 arguments (XINFO FULL, SET KEEPTTL)
66+
[a0c53e0b](https://github.com/phpredis/phpredis/commit/a0c53e0b30e0c6af15cc137415e7d65f6d1867f7),
67+
[f9c7bb57](https://github.com/phpredis/phpredis/commit/f9c7bb5788c39614c23e3bb9ec42ec8d6d5bbaa1)
68+
([Victor Kislov](https://github.com/vityank),
69+
[Michael Grunder](https://github.com/michael-grunder))
70+
71+
- Support for TLS connections
72+
[890ee0e6](https://github.com/phpredis/phpredis/commit/890ee0e656e545b18179cf247db94a33179ce1ab),
73+
[b0671296](https://github.com/phpredis/phpredis/commit/b067129678264fc1c5c0f611ce1b192e05c14669)
74+
([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko))
75+
76+
- New option Redis::SCAN_PREFIX, Redis::SCAN_NOPREFIX
77+
[e80600e2](https://github.com/phpredis/phpredis/commit/e80600e244b8442cb7c86e99b067966cd59bf2ee)
78+
([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko))
79+
80+
- Configurable unit test authentication arguments
81+
[e37f38a3](https://github.com/phpredis/phpredis/commit/e37f38a39eb4bece8f49ebd0652112dc992084a0),
82+
[201a9759](https://github.com/phpredis/phpredis/commit/201a97599953a9621bb8eb02dc8d5f08d16499a3)
83+
([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko),
84+
[Michael Grunder](https://github.com/michael-grunder))
85+
86+
### Fixed
87+
88+
- Improved cluster slot caching mechanism to fix a couple of bugs and make it more efficient.
89+
[5ca4141c](https://github.com/phpredis/phpredis/commit/5ca4141c72e23816f146b49877a6a4b8098b34c6)
90+
([Michael Grunder](https://github.com/michael-grunder))
91+
92+
- Stop calling Redis constructor when creating a RedisArray
93+
[e41e19a8](https://github.com/phpredis/phpredis/commit/e41e19a8342212ee9cfe35f622804c9870d05ec2)
94+
([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko))
95+
96+
- Use ZEND_LONG_FMT instead of system `long`
97+
[5bf88124](https://github.com/phpredis/phpredis/commit/5bf881244dd30b5310fcfcaf5bcd8f9e2675bb01)
98+
([Michael Grunder](https://github.com/michael-grunder))
99+
100+
- Use long for SCAN iteration to fix potential overflow
101+
[f13f9b7c](https://github.com/phpredis/phpredis/commit/f13f9b7c7f5e3a7d286b412541199a408a0a98bd)
102+
([Victor Kislov](https://github.com/vityank))
103+
104+
- Fix config.m4 to test for the variable $PHP_REDIS_JSON and not the literal PHP_REDIS_JSON
105+
[20a3dc72](https://github.com/phpredis/phpredis/commit/20a3dc7251cb0bf450ef2a1cfeeeaeaa10355cd2)
106+
([Mizuki Nakano](https://github.com/mi-nakano))
107+
108+
- Fix compiler warnings
109+
[b9b383f4](https://github.com/phpredis/phpredis/commit/b9b383f49939484dcddf1a5edefdb9d753baa7f8),
110+
[215828e](https://github.com/phpredis/phpredis/commit/215828e3474dfd9ea72fdc6da67aa6bee2d95ddf)
111+
([Remi Collet](https://github.com/remicollet), [Pavlo Yatsukhnenko](https://github.com/yatsukhnenko))
112+
113+
- Avoid use-after-free of RediSock
114+
[8c45816d](https://github.com/phpredis/phpredis/commit/8c45816dbf4746f6557f83332be874bd78b5ce34)
115+
([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko))
116+
117+
- Fixed ZADD arginfo
118+
[a8e2b021](https://github.com/phpredis/phpredis/commit/a8e2b021f9eb51ad3ed0cc89064e2f004c56f8ba)
119+
([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko))
14120

15121
### Changed
16122

17-
- Use the portable `ZEND_LONG_FORMAT` family instead of C format specifiers
18-
[b9b383f4](https://github.com/phpredis/phpredis/commit/b9b383f4)
19-
([Remi Collet](https://github.com/remicollet))
123+
- Store AUTH information in flags RedisSock rather than duplicating information.
124+
[58dab564](https://github.com/phpredis/phpredis/commit/58dab5649fcc2cc63f5a29df83f783e154d7fa22)
125+
([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko))
20126

21-
- Make unit test authentication configurable
22-
[201a9759](https://github.com/phpredis/phpredis/commit/201a9759)
23-
([Michel Grunder](https://github.com/michael-grunder))
127+
- Refactor redis_sock_get_connection_pool logic.
128+
[73212e1](https://github.com/phpredis/phpredis/commit/73212e141403ec47441142fe1c7fd5fad24f6720)
129+
([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko))
130+
131+
- Updated documentation to show LPUSH and RPUSH are variadic and fixed DEL documentation.
132+
[92f8dde1](https://github.com/phpredis/phpredis/commit/92f8dde1c996d4e1c3d79226b888119307612c40)
133+
([Michael Grunder](https://github.com/michael-grunder))
134+
135+
- Authenticate in redis_server_sock_open
136+
[4ef465b5](https://github.com/phpredis/phpredis/commit/4ef465b57325d2d93234fd66af06a7091ce7d1ea)
137+
([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko))
138+
139+
- Dynamically include json.so in unit tests based on configuration
140+
[0ce7ca2f](https://github.com/phpredis/phpredis/commit/0ce7ca2fb1eb2f3c445487957a49b70ad8d4ecb6)
141+
(([Michael Grunder](https://github.com/michael-grunder))
142+
143+
- Update save_path logic in Redis Cluster session unit tests
144+
[dd66fce](https://github.com/phpredis/phpredis/commit/dd66fceeb232f9e1fb0a26373949e810180dc5fc)
145+
([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko))
24146

25-
- Various small changes in library and cluster_library
26-
[73212e14](https://github.com/phpredis/phpredis/commit/73212e14),
27-
[460c8f29](https://github.com/phpredis/phpredis/commit/460c8f29)
147+
- Refactoring various bits of logic
148+
[bbcf32a3](https://github.com/phpredis/phpredis/commit/bbcf32a37fa856ba0b50b489ba05bd3d43800fcc),
149+
[a42cf189](https://github.com/phpredis/phpredis/commit/a42cf189a776fc43acf47ca519f1d7385cc27f2f),
150+
[460c8f29](https://github.com/phpredis/phpredis/commit/460c8f29239c263e15a093c9bcdb6fb24587ec7d),
151+
[b7f9df75](https://github.com/phpredis/phpredis/commit/b7f9df758b30187864012d5cd831dbbc5fa053d0),
28152
([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko))
29153

154+
- Use the portable `ZEND_LONG_FORMAT` family instead of C format specifiers
155+
[b9b383f4](https://github.com/phpredis/phpredis/commit/b9b383f4)
156+
([Remi Collet](https://github.com/remicollet))
157+
30158
- PHP 8 compatibility
31159
[9ee94ca4](https://github.com/phpredis/phpredis/commit/9ee94ca4),
32160
[7e4c7b3e](https://github.com/phpredis/phpredis/commit/7e4c7b3e)

README.markdown

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ You can also make a one-time contribution with one of the links below.
2020
[![Ethereum](https://en.cryptobadges.io/badge/micro/0x43D54E32357B96f68dFF0a6B46976d014Bd603E1)](https://en.cryptobadges.io/donate/0x43D54E32357B96f68dFF0a6B46976d014Bd603E1)
2121

2222
## Sponsors
23-
24-
<a href="https://audiomack.com">
25-
<img src="https://styleguide.audiomack.com/styleguide/assets/dl/inline-orange-large.png" alt="Audiomack.com" width="150">
26-
</a>
23+
<a href="https://audiomack.com"><img src="https://styleguide.audiomack.com/styleguide/assets/dl/inline-orange-large.png" alt="Audiomack.com" width="150"></a><a href="https://bluehost.com"><img src="https://upload.wikimedia.org/wikipedia/commons/2/22/Bluehost-logo.png" alt="Bluehost.com" width="150"></a>
2724

2825
# Table of contents
2926
-----
@@ -221,6 +218,9 @@ $redis->connect('tls://127.0.0.1'); // enable transport level security, port 637
221218
$redis->connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.
222219
$redis->connect('/tmp/redis.sock'); // unix domain socket.
223220
$redis->connect('127.0.0.1', 6379, 1, NULL, 100); // 1 sec timeout, 100ms delay between reconnection attempts.
221+
222+
/* With PhpRedis >= 5.3.0 you can specify authentication information on connect */
223+
$redis->connect('127.0.0.1', 6379, 1, NULL, 0, 0, ['auth' => ['phpredis', 'phpredis']]);
224224
~~~
225225

226226
**Note:** `open` is an alias for `connect` and will be removed in future versions of phpredis.
@@ -291,6 +291,10 @@ $redis->auth(['phpredis', 'haxx00r']);
291291

292292
/* Authenticate with the password 'foobared' */
293293
$redis->auth(['foobared']);
294+
295+
/* You can also use an associative array specifying user and pass */
296+
$redis->auth(['user' => 'phpredis', 'pass' => 'phpredis]);
297+
$redis->auth(['pass' => 'phpredis']);
294298
~~~
295299

296300
### select
@@ -4327,10 +4331,10 @@ using a persistent ID, and FALSE if we're not connected
43274331

43284332
### getAuth
43294333
-----
4330-
_**Description**_: Get the password used to authenticate the phpredis connection
4334+
_**Description**_: Get the password (or username and password if using Redis 6 ACLs) used to authenticate the connection.
43314335

43324336
### *Parameters*
43334337
None
43344338

43354339
### *Return value*
4336-
*Mixed* Returns the password used to authenticate a phpredis session or NULL if none was used, and FALSE if we're not connected
4340+
*Mixed* Returns NULL if no username/password are set, the password string if a password is set, and a `[username, password]` array if authenticated with a username and password.

library.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,10 @@ redis_pool_spprintf(RedisSock *redis_sock, char *fmt, ...) {
777777
smart_str_append_long(&str, (zend_long)redis_sock->port);
778778

779779
/* Short circuit if we don't have a pattern */
780-
if (fmt == NULL)
780+
if (fmt == NULL) {
781+
smart_str_0(&str);
781782
return str.s;
783+
}
782784

783785
while (*fmt) {
784786
switch (*fmt) {
@@ -808,6 +810,7 @@ redis_pool_spprintf(RedisSock *redis_sock, char *fmt, ...) {
808810
fmt++;
809811
}
810812

813+
smart_str_0(&str);
811814
return str.s;
812815
}
813816

@@ -2118,13 +2121,26 @@ static int redis_uniqid(char *buf, size_t buflen) {
21182121
(long)tv.tv_sec, (long)tv.tv_usec, (long)php_rand());
21192122
}
21202123

2124+
static int redis_stream_liveness_check(php_stream *stream) {
2125+
return php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS,
2126+
0, NULL) == PHP_STREAM_OPTION_RETURN_OK ?
2127+
SUCCESS : FAILURE;
2128+
}
2129+
21212130
static int
21222131
redis_sock_check_liveness(RedisSock *redis_sock)
21232132
{
21242133
char id[64], ok;
21252134
int idlen, auth;
21262135
smart_string cmd = {0};
21272136

2137+
/* Short circuit if we detect the stream has gone bad or if the user has
2138+
* configured persistent connection "YOLO mode". */
2139+
if (redis_stream_liveness_check(redis_sock->stream) != SUCCESS)
2140+
return FAILURE;
2141+
else if (!INI_INT("redis.pconnect.echo_check_liveness"))
2142+
return SUCCESS;
2143+
21282144
/* AUTH (if we need it) */
21292145
auth = redis_sock_append_auth(redis_sock, &cmd);
21302146

0 commit comments

Comments
 (0)