I need to store some array data in a cookie and I have been researching the best way to do it, many people seem to say using serialize
is the way to go, but then in this thread:
PHP how to stringify array and store in cookie
..someone suggested against using it as "serialize will call constructor of a serialized class. This is bad because it can cause code execution."
So I'm wondering what other options I have? What about base64_encode
?
I can't use sessions
as I need to retain the data AFTER the browser is closed; though I am also worried about Cookies 4KB
limit.
FWIW I am storing shopping cart data of what is stored in someones cart, it needs to be loaded back in their cart when they come back.