Changelog History
Page 2
-
v1.1.5 Changes
September 10, 2020๐ Here we have a new patch release!
NOTE: We are still missing handlers for commands added in Redis 4, 5 and 6. We will get on par eventually, in the meanwhile you can define your own ones or use
Predis\Client::executeRaw()
. Read this post for details about how to properly implement support for new commands if you would like to add missing ones and share your work with us by creating pull requests, contributions are always greatly appreciated!๐ NOTE intentionally commented out, please read the release notes for v1.1.6
๐ FIX : authentication for sentinels is now supported, previously it was not possible to specify apassword
for sentinels as its value was stripped during initialization because sentinels did not support authentication until Redis 5. Please note that with the current implementation each sentinel must have its ownpassword
parameter set in the parameters list despite this password is the same for all sentinels (read howrequirepass
works on the Redis docs). In this case you should avoid using the globalparameters
client option used to set default parameters for every connection created by Predis as this would end up using the same password even when connecting to actual Redis nodes. We are investiganting how to make it easier to specify the required password to access sentinels only once instead of repeating it for each sentinel.๐ FIX : the username is now correctly retrieved from the userinfo fragment of the URI when using the
redis
scheme and ausername:password
pair is present. Values retrieved from the userinfo fragment always override the ones specified inusername
andpassword
if those fields are present in the query string.๐ FIX :
Predis\Connection\WebdisConnection
was unable to connect to Webdis when using an IPv4 address in the URL and this is probably due to some change in cURL internals since the last time we tested it.๐ FIX : an exception is thrown when passing
FALSE
or any value evaluating toFALSE
to thereplication
client option. This was supposed to be unsupported, in fact it actually breaks client initialization and raises a PHP warning. Now the user is alerted with anInvalidArgumentException
and a proper message. (PR #381). -
v1.1.4 Changes
August 31, 2020๐ Here is a new patch release for
v1.1
with more improvements and fixes.NOTE: We are still missing handlers for commands added in Redis 4, 5 and 6. We will get on par eventually, in the meanwhile you can define your own ones or use
Predis\Client::executeRaw()
. Read this post for details about how to properly implement support for new commands if you would like to add missing ones and share your work with us by creating pull requests, contributions are always greatly appreciated!The client can now handle ACL authentication when connecting to Redis 6 , just pass both
username
andpassword
to connection parameters and Predis switches to using the augmented variant ofAUTH
:// When using an URI string for parameters:$client = new Predis\Client('tcp://127.0.0.1?username=myuser&password=mypassword');// When using a named array for parameters:$client = new Predis\Client(['username' =\> 'myuser', 'password' =\> 'mypassword',]);
๐ As usual Redis servers protected only by a password can still be accessed with just the
password
parameter. See the Redis documentation for more details about Redis ACLs.๐ FIX :
NULL
or zero-length string values inpassword
anddatabase
do not trigger spuriousAUTH
andSELECT
commands anymore when connecting to Redis.// Won't trigger `AUTH` and `SELECT`:$client = new Predis\Client('tcp://127.0.0.1?password=&database=');// Won't trigger `AUTH` and `SELECT`:$client = new Predis\Client(['password' =\> null, 'database' =\> '',]);
๐ This fix addresses some old issues with certain libraries and frameworks (see ISSUE #436).
๐ Empty connection parameters do not make much sense anyway so, in the next major release , any field containing
NULL
or a zero-length string will be stripped away when converting URI strings and named arrays to instances ofPredis\Connection\Parameters
.๐ FIX :
SORT
now always triggers a switch to the master node in replication configurations instead of just when theSTORE
modifier is specified. The reason for this change is thatSORT
is always considered to be a write operation and it actually fails with a-READONLY
error response when executed against a replica node (ISSUE #554).๐ FIX : using
foreach()
on a client instance when it is connected to a single Redis server does not throw an exception anymore but the iteration will run for just one loop returning a new client for the underlying single-node connection (ISSUE #552, PR #556).$client = new Predis\Client('tcp://127.0.0.1');foreach ($client as $clientNode) { // Iterates just once, does not throw an exception anymore.}
๐ป Using
foreach()
actually makes sense when using aggregate connection backends for client-side sharding orredis-cluster
but there is no reason (and it is wrong anyway) to throw an exception inPredis\Client::getIterator()
when the client is connected to a single server.๐ FIX :
Predis\Cluster\Distributor\HashRingaddNodeToRing
was calculating the hash required for distribution by usingcrc32()
directly instead of the methodPredis\Cluster\Hash\HashGeneratorInterface::hash()
implemented by the class itself. This fix does not have any impact on existing cluster deployments using client-side sharding based on this distributor simply because it does not take any external hash generators so distribution is not going to be affected.๐ Improved
@method
annotations for methods responding to Redis commands defined byPredis\ClientInterface
andPredis\ClientContextInterface
(PR #456 and PR #497, other fixes applied after further analysys). -
v1.1.3 Changes
August 18, 2020Ensure compatibility with PHP 8.
๐ Moved repository from
github.com/nrk/predis
togithub.com/predis/predis
.๐ FIX: Moved
cweagans/composer-patches
dependency torequire-dev
.๐ FIX: Include PHPUnit
.patch
files in exports.
-
v1.1.2 Changes
August 11, 2020๐ฑ Predis is under new management. Read the announcement and checkout the roadmap ๐
๐ If you (or your business) would like to support the development of this fantastic library and ensure it's bright future, please use the GitHub Sponsor button ๐๐ป
๐ Changes
๐ FIX : pure CRC16 implementation failed to calculate the correct hash when
the input value passed to thehash()
method is an integer (PR #450).๐ FIX : make PHP iterator abstractions for
ZSCAN
andHSCAN
working with
PHP 7.2 due to a breaking change, namely the removal ofeach()
(PR #448). -
v1.1.1 Changes
June 17, 2016๐ This is a patch release of Predis v1.1 that fixes a few bugs affecting the previous release. As usual you can read the CHANGELOG for a schematic list of the changes.
๐ Bug fixes
- ๐ FIX :
password
anddatabase
from the globalparameters
client option were still being applied to sentinels connections making them fail (sentinels do not understand theAUTH
andSELECT
commands) (PR #346). - ๐ FIX : when a sentinel instance reports no slave for a service, invoking
connect()
on the redis-sentinel connection backend should fall back to the master connection instead of failing (ISSUE #342). - ๐ FIX : the two connection backends based on ext-phpiredis has some kind of issues with the GC and the internal use of closures as reader callbacks that prevented connections going out of scope from being properly collected and the underlying stream or socket resources from being closed and freed. This should not have had any actual effect in real-world scenarios due to the lifecycle of PHP scripts, but we fixed it anyway (ISSUE #345).
Other links
- ๐ FIX :
-
v1.1.0 Changes
June 02, 2016Introduction
๐ This is a minor release of Predis packed with new features and various improvements of existing ones. As usual you can read the CHANGELOG for a schematic list of the changes. Thanks to anyone who provided feedback, especially on the new features, and proposed changes implemented in this release! Starting today we also have a chat room on Gitter, for now it's kind of an experiment but we'll see on the long run if it'll prove to be useful.
IMPORTANT : if you are using
"predis/predis": "dev-master"
incomposer.json
then replace the requirement with tagged releases in the v1.1 branch as soon as possible! Starting today themaster
branch will host the development of the next major version of Predis, the first few commits containing some major breaking changes will land there in a matter of days meaning that if you won't replacedev-master
your applications may (and most likely will) fail all of sudden.NOTE : speaking of Predis v2.0 we are aiming to bump the minimum required version of PHP to 5.5.9 (most likely to happen) and drop PEAR for distribution (still to be decided). The v1.1 branch will be maintaned for fixes so if you are stuck with PHP 5.3 and 5.4 you don't have too much to worry about for a while. If you have anything to say on the matter please join the discussion by leaving a comment or a reaction on #335, we need your feedback!
๐ New features
Support for redis-sentinel is finally baked into Predis! As usual configuring the client is easy, it's just a matter of providing a list of sentinel servers and configure the client accordingly:
$parameters = ['tcp://127.0.0.1:5380', 'tcp://127.0.0.1:5381', 'tcp://127.0.0.1:5382'];$options = ['replication' =\> 'sentinel', // use the appropriate replication backend'service' =\> 'mymaster', // provide a service name for discovery];$client = new Predis\Client($parameters, $options);
See
replication_sentinel.php
for a complete example.Redis servers protected by SSL-encrypted connections can be accessed by using the
tls
orrediss
scheme in connection parameters along with SSL-specific options in thessl
parameter (array):// Parameters in the form of a named array$parameters = ['scheme' =\> 'tls','host'=\> '127.0.0.1','ssl'=\> ['cafile' =\> '/path/to/redis.pem','verify\_peer\_name' =\> true,],];// Parameters in the form of an URI string$parameters = 'tls://127.0.0.1?ssl[cafile]=/path/to/redis.pem&ssl[verify\_peer\_name]=1';
0๏ธโฃ Implemented the ability to specify default connection parameters for aggregate connections with the new
parameters
client option. These parameters augment the usual user-supplied connection parameters (but do not take the precedence over them) when creating new connections and they are mostly useful when the client is using aggregate connections such as redis-cluster and redis-sentinel as these backends can create new connections on the fly based on responses and redirections from Redis:$parameters = ['tcp://127.0.0.1:6381', 'tcp://127.0.0.1:6382', 'tcp://127.0.0.1:6383'];$options = ['cluster' =\> 'redis',// New connections to Redis will be created using the same following parameters:'parameters' =\> ['database' =\> 5, 'password' =\> $secret],];$client = new Predis\Client($parameters, $options);
Predis\Client
implements theIteratorAggregate
interface making it is possible to iterate over traversable aggregate connections and get a new client instance for each Redis node:$client = new Predis\Client($parameters, ['cluster' =\> 'redis']);foreach ($client as $nodeClient) {$nodeClient-\>flushdb(); // executes FLUSHDB on each node of the cluster}
๐ Changes
- 0๏ธโฃ The default server profile for the client now targets Redis 3.2.
- ๐ Responses to the following list of commands are not casted into booleans anymore but instead the original integer value of the response is returned:
SETNX
,MSETNX
,SMOVE
,SISMEMBER
,HSET
,HSETNX
,HEXISTS
,PFADD
,EXISTS
,MOVE
,PERSIST
,EXPIRE
,EXPIREAT
,RENAMENX
. This change does not have a significant impact unless when using strict comparisons (===
and!==
) on the returned value. - ๐ Using
unix:///path/to/socket
in URI strings to specify a UNIX domain socket file is now deprecated in favor of the formatunix:/path/to/socket
(note the lack of the double slash after the scheme) and will not be supported starting with the next major release. - ๐ป The client throws exceptions when Redis returns any kind of error response to initialization commands (the ones being automatically sent when a connection is established, such as
SELECT
andAUTH
when database and password are set in connection parameters) regardless of the value of the exception option. - ๐ Iterating over an instance of
Predis\Connection\Aggregate\RedisCluster
will return all the connections mapped in the slots map instead of just the ones in the in-memory pool. This change makes it possible, when the slots map is retrieved from Redis, to iterate over all of the master nodes in the cluster. When the use ofCLUSTER SLOTS
is disabled via theuseClusterSlots()
method, the iteration returns only the connections with slots ranges associated in their parameters or the ones initialized by-MOVED
responses in order to make the behaviour of the iteration consistent between the two modes of operation.
๐ Improvements
Non-boolean string values passed to the
persistent
connection parameter can be used to create different persistent connections to the same host-port pair:// $parameters1 and $parameters2 will create two different persistent connections:$parameters1 = "tcp://127.0.0.1:6379?persistent=first";$parameters2 = "tcp://127.0.0.1:6379?persistent=second";
Note that this feature was already present in Predis but required both
persistent
andpath
to be set as illustrated by #139, this change was needed to prevent confusion with howpath
is used to select a database when using theredis
scheme.Various improvements to
Predis\Connection\Aggregate\MasterSlaveReplication
(the "basic" replication backend, not the new one based on redis-sentinel):- When the client is not able to send a read-only command to a slave because the current connection fails or the slave is resyncing (
-LOADING
response returned by Redis), the backend discards the failed connection and performs a new attempt on the next slave. When no other slave is available the master server is used for read-only commands as last resort. - It is possible to discover the current replication configuration on the fly by invoking the
discover()
method which internally relies on the output of the commandINFO REPLICATION
executed against the master server or one of the slaves. The backend can also be configured to do this automatically when it fails to reach one of the servers. - Implemented the
switchToMaster()
andswitchToSlave()
methods to make it easier to force a switch to the master server or a random slave when needed.
Other links
-
v1.0.4 Changes
May 30, 2016๐ This is a maintenance release for the 1.0 series. What follows is an overview of the changes and bug fixes introduced in this release, more details are available in the CHANGELOG.
IMPORTANT : Predis v1.1.0 is going to be released in just a few days, this minor release will ship with various improvements and the much-awaited support for redis-sentinel. Soon after that the
master
branch will host the development of Predis v2.0 and the first major change will be a bump of the minimum required version of PHP to 5.5.9, please read about it here and leave a comment if you have something to say on the matter as the decision has not been finalized as of yet.๐ Improvements
- โ Added a new profile for Redis 3.2 with its new commands:
HSTRLEN
,BITFIELD
,GEOADD
,GEOHASH
,GEOPOS
,GEODIST
,GEORADIUS
,GEORADIUSBYMEMBER
. The default server profile for Predis is still the one for Redis 3.0 so you must set theprofile
client option to3.2
when initializing the client in order to be able to use them when connecting to Redis 3.2. - redis-cluster: when the connection to a specific node fails the client tries to connect to another node in order to refresh the slots map and perform a new attempt to execute a command.
- redis-cluster: connections to nodes can now be preassigned to non-contiguous slot ranges via the
slots
parameter using a comma separator (e.g.tcp://127.0.0.1:6379?slots=0-5460,5500-5600,11000
)
๐ Bug fixes
- ๐ FIX :
Predis\Collection\Iterator\HashKey
was returning corrupted values when iterating hash keys containing integer fields (PR #330, ISSUE #331). - ๐ FIX :
Predis\Connection\StreamConnection
andPredis\Protocol\Text\RequestSerializer
do not fail when serializing commands with holes in their arguments (e.g.[0 => 'key:0', 2 => 'key:2']
) just like the phpiredis-based connection backends (ISSUE #316).
Other links
- โ Added a new profile for Redis 3.2 with its new commands:
-
v1.0.3 Changes
July 30, 2015๐ This is a maintenance release for the 1.0 series. What follows is an overview of the changes and bug fixes introduced in this release, more details are available in the CHANGELOG.
IMPORTANT NOTICE : this release supersedes v1.0.2.
๐ Bug fixes
- ๐ FIX : the previous release introduced a severe regression on HHVM preventing the client from connecting to Redis using IPv4 addresses. Code running on the standard PHP interpreter is unaffected. (#269)
Other links
-
v1.0.2 Changes
July 30, 2015๐ This is a maintenance release for the 1.0 series. What follows is an overview of the changes and bug fixes introduced in this release, more details are available in the CHANGELOG.
IMPORTANT NOTICE : this release has been superseded by v1.0.3 due to a severe regression affecting only HHVM preventing the client from connecting to Redis using IPv4 addresses. Code running on the standard PHP interpreter is unaffected.
๐ Improvements
- ๐ IPv6 is fully supported.
- ๐ The
redis
scheme can be used in URI strings and is considered an alias oftcp
but the rules applied when parsing the URI follow the provisional registration document published by IANA while the usual Predis-specific rules still apply when usingtcp
and other schemes. - Implemented some missing commands:
HSTRLEN
(Redis >= 3.2),ZREVRANGEBYLEX
(Redis >= 2.8) andMIGRATE
(>= 2.6). - The
ZADD
modifiersNX|XX
,CH
,INCR
introduced in Redis 3.0.2 can also be used with the simplified signature of this command where scores and members are passed as a named array.
๐ Bug fixes
- ๐ FIX :
Predis\Configuration\Options
must not trigger the autoloader when values are strings (#257). - ๐ FIX :
BITPOS
was not defined in the key-prefix processor (#265) and in the replication strategy.
Notes
- ๐ Predis v1.1.0 should follow in just a few weeks and, being a minor release, will deliver more than just bugfixes or minor improvements. The addition of support for redis-sentinel is a long-standing feature request that will hopefully find its way into the library (see #131) and some major and much needed improvements to redis-cluster are also scheduled (see #173). As usual any help is more than appreciated so feel free to hop on these issues for sharing ideas and advices, or even contribute with a pull request.
Other links
-
v1.0.1 Changes
July 30, 2015๐ This is a maintenance release for the 1.0 series. What follows is an overview of the changes and bug fixes introduced in this release, more details are available in the CHANGELOG.
๐ Improvements
- โ Added the
BITPOS
command to the server profile for Redis 2.8 (pull request by @nicchap). - 0๏ธโฃ It is now possible to specify a timeout for read/write operations also when using UNIX domain sockets with
Predis\Connection\StreamConnection
which is the default connection class based on PHP's streams (pull request by @srhnsn).
๐ Bug fixes
- ๐ A bug prevented
Predis\Collection\Iterator\SortedSetKey
to work correctly when iterating over sorted sets containing integer members (see #216). - ๐ Applied a workaround for a bug in old versions of PHP < 5.3.9 affecting inheritance (see 99f4312).
- Prevent
E_NOTICE
messages from being emitted when requesting empty or unexistent info sections usingINFO
.
Notes
- ๐ Due to a bug in HHVM <= 3.4.0, it is not possible to use
Predis\PubSub\Consumer
andPredis\Monitor\Consumer
when running under Facebook's runtime for now. You can find more details in the discussion on #231 (thanks @rubensayshi for the catch!) which also provides an hack to work around this issue until the next release of HHVM will ship with their bug fixed.
Downloads
- โ Added the