class - PHP: is it safe to deserialize a file directly into an object? -
In my PHP code, I create a 'session' object that stores the user type, audio and so on. (Although no password is the form). Then I serialize this object to $ _SESSION var:
$ _ session ['sess_data'] = carii ($ session);
When I need to authenticate the user, I do this:
$ session = unserialize ($ _ session ['sess_data'] );
Although it looks very insecure to me. How Can I Improve It? Are some get_class () sufficient as a method? Thanks
Comments
Post a Comment