note 87623 deleted from function.session-set-save-handler by drak

From: Date: Sun, 11 Mar 2012 04:29:48 +0000
Subject: note 87623 deleted from function.session-set-save-handler by drak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-186591@lists.php.net to get a copy of this message
Note Submitter: patrick at eternalspace dot com ---- After about 8 hours of banging my skull on abstract art, it turns out that custom Write function use a blackbox encoding process that isn't represented here! (Perhaps in session_encode it is?) When a custom write() method gets the $session_hash and the $data of the session, the $data has binary data in it! Therefore, stripslashes() or mysql_real_escape_string() will NOT properly prepare a collapsed $_SESSION string for database storage! Instead, when committing write() $data to a database, it turns out that base64_encode() *WILL* catch all non-character information in the collapsed $_SESSION string, making it's result database-friendly! (And more filling!) Don't forget to add base64_decode() during the custom read() method!

« previous php.notes (#186591) next »