mirror of
https://github.com/predis/predis.git
synced 2026-08-28 03:02:04 +00:00
Improve detection of STORE in SORT command arguments.
This commit is contained in:
@@ -338,7 +338,7 @@ class KeyPrefixProcessor implements ProcessorInterface
|
||||
|
||||
if (($count = count($arguments)) > 1) {
|
||||
for ($i = 1; $i < $count; ++$i) {
|
||||
switch ($arguments[$i]) {
|
||||
switch (strtoupper($arguments[$i])) {
|
||||
case 'BY':
|
||||
case 'STORE':
|
||||
$arguments[$i] = "$prefix{$arguments[++$i]}";
|
||||
|
||||
@@ -100,8 +100,18 @@ class ReplicationStrategy
|
||||
protected function isSortReadOnly(CommandInterface $command)
|
||||
{
|
||||
$arguments = $command->getArguments();
|
||||
$argc = count($arguments);
|
||||
|
||||
return ($c = count($arguments)) === 1 ? true : $arguments[$c - 2] !== 'STORE';
|
||||
if ($argc > 1) {
|
||||
for ($i = 1; $i < $argc; $i++) {
|
||||
$argument = strtoupper($arguments[$i]);
|
||||
if ($argument === 'STORE') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user