amphp / redis

Efficient asynchronous communication with Redis servers, enabling scalable and responsive data storage and retrieval.

Home Page:https://amphp.org/redis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No error when passing array to set() as value

vuliad opened this issue · comments

No error throws when passing an array instead of string to SET().

<?php
(new Host)->use(
    function (\Aerys\Request $req, \Aerys\Response $res) use ($app) {
        $client = new \Amp\Redis\Client("tcp://localhost:6379");
        try {
            $result = yield $client->set("dataArray", ['aaaa' => 'bbbb']);
        } catch (\Exception $e) {
            yield $res->stream('error');
        }
        yield $res->stream('finish');
    });
?>

And it just wait forever.
exceptionHandler really catch "strlen() expects parameter 1 to be string, array given", but then it loop forever.

This doesn't affect just set, it affects almost all methods.

Should be fine for all methods now, since we check it in Connection::send now. I'm not sure whether I'll release a new version for this or not. It's in the current dev-master at least and will be included in the next release. I think I'll release it as extra version if nothing else appears in the next few days or so.

Thanks again for your feedback!