mirror of
https://github.com/predis/predis.git
synced 2026-08-20 11:12:08 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c50c3393bb | |||
| 4aa3014bb0 | |||
| 92adf32e88 | |||
| c4560304cf | |||
| cf5c118a07 | |||
| bb9a670c83 | |||
| 3e56e880e8 | |||
| 1c71a4e36e | |||
| 5004f5d6fc | |||
| e616f85679 | |||
| 9cd093be24 | |||
| 305d167b08 | |||
| 3271e1edcb |
+5
-1
@@ -1,19 +1,23 @@
|
||||
language: php
|
||||
sudo: false
|
||||
|
||||
branches:
|
||||
except:
|
||||
- v0.5
|
||||
- v0.6
|
||||
- v0.6-PHP_5.2
|
||||
- documentation
|
||||
|
||||
before_install:
|
||||
- docker run -d --rm -p 127.0.0.1:6379:6379 redis:3
|
||||
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini
|
||||
- composer self-update
|
||||
- composer install --no-interaction --prefer-source --dev
|
||||
|
||||
script:
|
||||
- travis_retry vendor/bin/phpunit -c phpunit.xml.travisci
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
v1.1.9 (2021-10-05)
|
||||
================================================================================
|
||||
|
||||
- Fixed PHP 8.1 compatibility in `StreamConnection`
|
||||
|
||||
|
||||
v1.1.8 (2021-09-29)
|
||||
================================================================================
|
||||
|
||||
- Ensure compatibility with PHP 8.1.
|
||||
|
||||
|
||||
v1.1.7 (2021-04-04)
|
||||
================================================================================
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ name = "Predis"
|
||||
desc = "Flexible and feature-complete Redis client for PHP and HHVM"
|
||||
homepage = "http://github.com/nrk/predis"
|
||||
license = "MIT"
|
||||
version = "1.1.7"
|
||||
version = "1.1.9"
|
||||
stability = "stable"
|
||||
channel = "pear.nrk.io"
|
||||
|
||||
|
||||
+2
-1
@@ -40,7 +40,7 @@ use Predis\Transaction\MultiExec as MultiExecTransaction;
|
||||
*/
|
||||
class Client implements ClientInterface, \IteratorAggregate
|
||||
{
|
||||
const VERSION = '1.1.7';
|
||||
const VERSION = '1.1.9';
|
||||
|
||||
protected $connection;
|
||||
protected $options;
|
||||
@@ -529,6 +529,7 @@ class Client implements ClientInterface, \IteratorAggregate
|
||||
/**
|
||||
* @return \Traversable<string, static>
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
$clients = array();
|
||||
|
||||
@@ -92,7 +92,7 @@ abstract class CursorBasedIterator implements \Iterator
|
||||
{
|
||||
$options = array();
|
||||
|
||||
if (strlen($this->match) > 0) {
|
||||
if (strlen(strval($this->match)) > 0) {
|
||||
$options['MATCH'] = $this->match;
|
||||
}
|
||||
|
||||
@@ -139,6 +139,7 @@ abstract class CursorBasedIterator implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
$this->reset();
|
||||
@@ -148,6 +149,7 @@ abstract class CursorBasedIterator implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return $this->current;
|
||||
@@ -156,6 +158,7 @@ abstract class CursorBasedIterator implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return $this->position;
|
||||
@@ -164,6 +167,7 @@ abstract class CursorBasedIterator implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
tryFetch: {
|
||||
@@ -184,6 +188,7 @@ abstract class CursorBasedIterator implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return $this->valid;
|
||||
|
||||
@@ -128,6 +128,7 @@ class ListKey implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
$this->reset();
|
||||
@@ -137,6 +138,7 @@ class ListKey implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return $this->current;
|
||||
@@ -145,6 +147,7 @@ class ListKey implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return $this->position;
|
||||
@@ -153,6 +156,7 @@ class ListKey implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
if (!$this->elements && $this->fetchmore) {
|
||||
@@ -169,6 +173,7 @@ class ListKey implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return $this->valid;
|
||||
|
||||
@@ -104,7 +104,7 @@ abstract class Command implements CommandInterface
|
||||
*/
|
||||
public static function normalizeArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 1 && is_array($arguments[0])) {
|
||||
if (count($arguments) === 1 && isset($arguments[0]) && is_array($arguments[0])) {
|
||||
return $arguments[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ class ProcessorChain implements \ArrayAccess, ProcessorInterface
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($index)
|
||||
{
|
||||
return isset($this->processors[$index]);
|
||||
@@ -99,6 +100,7 @@ class ProcessorChain implements \ArrayAccess, ProcessorInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($index)
|
||||
{
|
||||
return $this->processors[$index];
|
||||
@@ -107,6 +109,7 @@ class ProcessorChain implements \ArrayAccess, ProcessorInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($index, $processor)
|
||||
{
|
||||
if (!$processor instanceof ProcessorInterface) {
|
||||
@@ -122,6 +125,7 @@ class ProcessorChain implements \ArrayAccess, ProcessorInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($index)
|
||||
{
|
||||
unset($this->processors[$index]);
|
||||
|
||||
@@ -31,7 +31,10 @@ class ServerSentinel extends Command
|
||||
*/
|
||||
public function parseResponse($data)
|
||||
{
|
||||
switch (strtolower($this->getArgument(0))) {
|
||||
$argument = $this->getArgument(0);
|
||||
$argument = is_null($argument) ? null : strtolower($argument);
|
||||
|
||||
switch ($argument) {
|
||||
case 'masters':
|
||||
case 'slaves':
|
||||
return self::processMastersOrSlaves($data);
|
||||
|
||||
@@ -34,7 +34,12 @@ abstract class CommunicationException extends PredisException
|
||||
$code = null,
|
||||
\Exception $innerException = null
|
||||
) {
|
||||
parent::__construct($message, $code, $innerException);
|
||||
parent::__construct(
|
||||
is_null($message) ? '' : $message,
|
||||
is_null($code) ? 0 : $code,
|
||||
$innerException
|
||||
);
|
||||
|
||||
$this->connection = $connection;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +178,7 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->pool);
|
||||
@@ -186,6 +187,7 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
||||
/**
|
||||
* @return \Traversable<string|int, NodeConnectionInterface>
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->pool);
|
||||
|
||||
@@ -602,6 +602,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->pool);
|
||||
@@ -610,6 +611,7 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
|
||||
/**
|
||||
* @return \Traversable<int, NodeConnectionInterface>
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
if ($this->useClusterSlots) {
|
||||
|
||||
@@ -387,7 +387,7 @@ class StreamConnection extends AbstractConnection
|
||||
$buffer = "*{$reqlen}\r\n\${$cmdlen}\r\n{$commandID}\r\n";
|
||||
|
||||
foreach ($arguments as $argument) {
|
||||
$arglen = strlen($argument);
|
||||
$arglen = strlen(strval($argument));
|
||||
$buffer .= "\${$arglen}\r\n{$argument}\r\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ class Consumer implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
// NOOP
|
||||
@@ -101,6 +102,7 @@ class Consumer implements \Iterator
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return $this->getValue();
|
||||
@@ -109,6 +111,7 @@ class Consumer implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return $this->position;
|
||||
@@ -117,6 +120,7 @@ class Consumer implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
++$this->position;
|
||||
@@ -127,6 +131,7 @@ class Consumer implements \Iterator
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return $this->valid;
|
||||
|
||||
@@ -151,6 +151,7 @@ abstract class AbstractConsumer implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
// NOOP
|
||||
@@ -162,6 +163,7 @@ abstract class AbstractConsumer implements \Iterator
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return $this->getValue();
|
||||
@@ -170,6 +172,7 @@ abstract class AbstractConsumer implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return $this->position;
|
||||
@@ -178,6 +181,7 @@ abstract class AbstractConsumer implements \Iterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
if ($this->valid()) {
|
||||
@@ -192,6 +196,7 @@ abstract class AbstractConsumer implements \Iterator
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
$isValid = $this->isFlagSet(self::STATUS_VALID);
|
||||
|
||||
@@ -62,7 +62,8 @@ class ReplicationStrategy
|
||||
}
|
||||
|
||||
if (($eval = $id === 'EVAL') || $id === 'EVALSHA') {
|
||||
$sha1 = $eval ? sha1($command->getArgument(0)) : $command->getArgument(0);
|
||||
$argument = $command->getArgument(0);
|
||||
$sha1 = $eval ? sha1(strval($argument)) : $argument;
|
||||
|
||||
if (isset($this->readonlySHA1[$sha1])) {
|
||||
if (true === $readonly = $this->readonlySHA1[$sha1]) {
|
||||
|
||||
@@ -34,6 +34,7 @@ abstract class MultiBulkIterator implements \Iterator, \Countable, ResponseInter
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
// NOOP
|
||||
@@ -42,6 +43,7 @@ abstract class MultiBulkIterator implements \Iterator, \Countable, ResponseInter
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return $this->current;
|
||||
@@ -50,6 +52,7 @@ abstract class MultiBulkIterator implements \Iterator, \Countable, ResponseInter
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return $this->position;
|
||||
@@ -58,6 +61,7 @@ abstract class MultiBulkIterator implements \Iterator, \Countable, ResponseInter
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
if (++$this->position < $this->size) {
|
||||
@@ -68,6 +72,7 @@ abstract class MultiBulkIterator implements \Iterator, \Countable, ResponseInter
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return $this->position < $this->size;
|
||||
@@ -82,6 +87,7 @@ abstract class MultiBulkIterator implements \Iterator, \Countable, ResponseInter
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return $this->size;
|
||||
|
||||
@@ -61,6 +61,7 @@ class MultiBulkTuple extends MultiBulk implements \OuterIterator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getInnerIterator()
|
||||
{
|
||||
return $this->iterator;
|
||||
|
||||
@@ -29,7 +29,7 @@ class AbortedMultiExecException extends PredisException
|
||||
*/
|
||||
public function __construct(MultiExec $transaction, $message, $code = null)
|
||||
{
|
||||
parent::__construct($message, $code);
|
||||
parent::__construct($message, is_null($code) ? 0 : $code);
|
||||
$this->transaction = $transaction;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ $patches = array(
|
||||
'phpunit_mock_objects.patch' => 'phpunit/phpunit-mock-objects',
|
||||
'phpunit_php7.patch' => 'phpunit/phpunit',
|
||||
'phpunit_php8.patch' => 'phpunit/phpunit',
|
||||
'phpunit_php81.patch' => 'phpunit/phpunit',
|
||||
);
|
||||
|
||||
foreach ($patches as $patch => $package) {
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
diff --git a/src/Util/Configuration.php b/src/Util/Configuration.php
|
||||
index b2f7a7bd0c6..1a1a444d378 100644
|
||||
--- a/src/Util/Configuration.php
|
||||
+++ b/src/Util/Configuration.php
|
||||
@@ -514,22 +514,17 @@ public function handlePHPConfiguration()
|
||||
|
||||
foreach (array('var', 'post', 'get', 'cookie', 'server', 'files', 'request') as $array) {
|
||||
// See https://github.com/sebastianbergmann/phpunit/issues/277
|
||||
- switch ($array) {
|
||||
- case 'var':
|
||||
- $target = &$GLOBALS;
|
||||
- break;
|
||||
-
|
||||
- case 'server':
|
||||
- $target = &$_SERVER;
|
||||
- break;
|
||||
-
|
||||
- default:
|
||||
- $target = &$GLOBALS['_' . strtoupper($array)];
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
foreach ($configuration[$array] as $name => $value) {
|
||||
- $target[$name] = $value;
|
||||
+ switch ($array) {
|
||||
+ case 'var':
|
||||
+ $GLOBALS[$name] = $value;
|
||||
+ break;
|
||||
+ case 'server':
|
||||
+ $_SERVER[$name] = $value;
|
||||
+ break;
|
||||
+ default:
|
||||
+ $GLOBALS['_' . strtoupper($array)][$name] = $value;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/Util/Getopt.php b/src/Util/Getopt.php
|
||||
index 370e97d73f8..5bd8553970b 100644
|
||||
--- a/src/Util/Getopt.php
|
||||
+++ b/src/Util/Getopt.php
|
||||
@@ -144,7 +144,7 @@ protected static function parseLongOption($arg, $long_options, &$opts, &$args)
|
||||
|
||||
if (substr($long_opt, -1) == '=') {
|
||||
if (substr($long_opt, -2) != '==') {
|
||||
- if (!strlen($opt_arg)) {
|
||||
+ if (null === $opt_arg || strlen($opt_arg) < 1) {
|
||||
$opt_arg = current($args);
|
||||
next($args);
|
||||
if (!($opt_arg)) {
|
||||
Reference in New Issue
Block a user