Skip to content

Why the null append? #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spondec opened this issue May 31, 2022 · 2 comments · Fixed by #40
Closed

Why the null append? #39

spondec opened this issue May 31, 2022 · 2 comments · Fixed by #40
Assignees
Labels
bug Something isn't working

Comments

@spondec
Copy link

spondec commented May 31, 2022

Hi,

I don't understand why appending null to the argument list when there is only one item?

A simple FLUSHALL command fails due to the error.

Code:

$redis = new \Redis()
$redis->rawCommand('FLUSHALL'); 

Result:

OK

Code:

$clientFacade = new \MacFJA\RediSearch\Redis\Client\ClientFacade();
$client = $clientFacade->getClient($redis = new \Redis());
$client->executeRaw('FLUSHALL');

Result:

 ErrorException

 Redis::rawcommand(): Raw command arguments must be scalar values!

 at vendor/macfja/redisearch/src/Redis/Client/PhpredisClient.php:81
    77if (count($args) < 2) {
    78$args[] = null;
    79▕         }
    80// @phpstan-ignore-next-line81return $this->redis->rawCommand(...$args);
    82▕     }
    8384protected function doPipeline(Command ...$commands): array
    85▕     {
@MacFJA
Copy link
Owner

MacFJA commented Jun 5, 2022

My bad, I was mislead by the "PhpDoc" that indicate that the function need at least 2 parameters.

But the documentation (and the code) indicate that only the first parameter is mandatory

I will fix it

@MacFJA MacFJA added the bug Something isn't working label Jun 5, 2022
@MacFJA MacFJA self-assigned this Jun 5, 2022
@MacFJA MacFJA closed this as completed in #40 Jun 6, 2022
@MacFJA
Copy link
Owner

MacFJA commented Jun 6, 2022

I made a correction and publish a new version (v2.1.2)

It should be better now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants