Skip to content
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

When using SERIALIZER_JSON, there is an error in reading data from the stream. #2404

Open
2 tasks done
bb7788 opened this issue Oct 13, 2023 · 0 comments
Open
2 tasks done

Comments

@bb7788
Copy link

bb7788 commented Oct 13, 2023

Expected behaviour

Actual behaviour

I'm seeing this behaviour on

  • OS: alpine 3.18
  • Redis: 7.2.1
  • PHP:8.2.10
  • phpredis: 6.0.2-dev/5.3.7

Steps to reproduce, backtrace or example script

When using XADD without enabling SERIALIZER_JSON

$redis->xAdd('mystream', '*', ['test_id' => '95512969651399437320899184672262088644',"test_data"=>json_encode(["a"=>1,"b"=>2])]);

When using xRead or xReadGroup with SERIALIZER_JSON enabled, the retrieved value of test_id is incorrect.

$redis->setOption(\Redis::OPT_SERIALIZER,\Redis::SERIALIZER_JSON);
var_dump($redis->xRead(["mystream" => '0']));

result:

array(1) {
  ["mystream"]=>
  array(1) {
    ["1697193543845-0"]=>
    array(1) {
      ["test_id"]=>
      float(9.551296965139944E+37)
    }
  }
}
$redis = new \Redis;
$redis->connect('127.0.0.1', 6379);
$redis->del("mystream");
$redis->xAdd('mystream', '*', ['test_id' => '95512969651399437320899184672262088644',"test_data"=>json_encode(["a"=>1,"b"=>2])]);
$redis->setOption(\Redis::OPT_SERIALIZER,\Redis::SERIALIZER_JSON);
var_dump($redis->xRead(["mystream" => '0']));

I've checked

  • There is no similar issue from other users
  • Issue isn't fixed in develop branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant