Closed mauriciv closed 2 years ago
Good work, LGTM 👍.
I am in general not a big fan of the fact that the package is serializing the cart in order to store it, it is just not atomic and comes with disatvantages for example if you have massive carts or want to work without session. That is also why the refactoring is currently blocked as i am looking for a good way to store each cart item seperately.
When using a PostgreSQL database, serializing the cart's content and storing them in a text column doesn't work. because PostegreSQL drops everything after a zero byte in text columns. And seeing as PHP's serialize adds zero bytes to private and protected members
this results as a truncated string being inserted in the
content
column and being unable to unserialize it later. This behaviour can be reproduced in the test suite by using a PostegreSQL database instead of a sqlite one.Using base64, we can sidestep this issue, the zero byte will only "live" in PHP, and never be inserted in PostgreSQL.
Unfotunately, using base64 will end up being a breaking change for those that are currently using a PostgreSQL database, although I would imagine that already implemented some form of workaround because they would have been impacted by this bug already.