userfrosting / cache

Cache module for UserFrosting
Other
2 stars 0 forks source link

Redis store casts integers to strings #8

Open Silic0nS0ldier opened 3 years ago

Silic0nS0ldier commented 3 years ago

Identified in https://github.com/userfrosting/UserFrosting/pull/1147 where this scenario was quite possibly tested for the first time. In essence, Laravel code makes a bad assumption about the behaviour of Redis's SETEX API. The API always casts values into a string, however the Laravel code does not serialize integer values.

Proposed solution here is to extend Illuminate\Cache\RedisStore (and Illuminate\Cache\CacheManager in order to have the extended class used) to replace the numeric specific logic in serialize and unserialize.

Screen Shot 2021-04-11 at 12 41 22 pm

Silic0nS0ldier commented 3 years ago

Relevent: https://github.com/Silic0nS0ldier/predis/commit/4a034778491ba5b12c7560fc47aa6cebc0025e25