0

I have a User table that has serialized data in one of the tables.

When the user logs in, that row for the user gets loaded into a session object. The issue is that the entire user object is then serialized by CI's Session library. This causes issues when unserializing. Digging down into the Session.php library, it looks like unserialize returns false.

Has anyone come across this or know of any way to better serialize serialized objects?

EDIT Correct, it's not serialized in my User table. It's saved as JSON. Which still breaks the unserialize

4
  • The better is just not serialize objects ever Commented Feb 19, 2012 at 22:25
  • Why not just store the user data in a session and let CI handle both the database contact and serialization? Commented Feb 19, 2012 at 22:25
  • I agree that it shouldn't be serialized in the first place.. but I'm inheriting this project and it is serialized. So what to do about it? Commented Feb 19, 2012 at 22:26
  • Saved in Json? try json_decode. Commented Feb 19, 2012 at 22:42

1 Answer 1

1

well if you data is saved as in json format then to bring it back to life (usable form) you should use json_decode function

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.