-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Description
- Laravel Version: 8.83.25
- PHP Version: 8.1.1
- Database Driver & Version:
Redis 6.0.6 on Ubuntu 22.04
Redis 6.2.7 on Fedora 36
PhpRedis 5.3.7
Description:
When you enable igbinary serializer for redis in database.php
, the actual value stored in redis is serialized with php serializer and some igbinary bytes are added at beginning.
Example:
\Cache::put('test', ['a', 'b'])
Actual value saved in Redis:
\x00\x00\x00\x02\x11\x1ea:2:{i:0;s:1:\"a\";i:1;s:1:\"b\";}
As for me, it looks like value is serialized with php serializer and afterwards is serialized with igbinary
Expected value in Redis (from igbinary_serialize()):
\0\0\0\x02\x14\x02\x06\0\x11\x01a\x06\x01\x11\x01b
Value from Redis if default serializer is used:
a:2:{i:0;s:1:"a";i:1;s:1:"b";}
As you see, default serializer value is even shorter than igbinary one, which should never be the case
Checked with more complex stuff, for example putting the model into cache, issue is the same - some bytes from igbinary in beginning and default serializer value aftrewards.
Steps To Reproduce:
- Enable
Redis::SERIALIZER_IGBINARY
serializer inconfig/database.php
- Save some array or object to cache
- Go to redis-cli and compare the value inside redis with
igbinary_serialize()
result