note 87623 added to function.session-set-save-handler

From: Date: Sat, 13 Dec 2008 03:09:08 +0000
Subject: note 87623 added to function.session-set-save-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-148114@lists.php.net to get a copy of this message
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! ---- Server IP: 64.71.164.2 Probable Submitter: 208.77.235.138 ---- Manual Page -- http://www.php.net/manual/en/function.session-set-save-handler.php Edit -- https://master.php.net/note/edit/87623 Del: integrated -- https://master.php.net/note/delete/87623/integrated Del: useless -- https://master.php.net/note/delete/87623/useless Del: bad code -- https://master.php.net/note/delete/87623/bad+code Del: spam -- https://master.php.net/note/delete/87623/spam Del: non-english -- https://master.php.net/note/delete/87623/non-english Del: in docs -- https://master.php.net/note/delete/87623/in+docs Del: other reasons-- https://master.php.net/note/delete/87623 Reject -- https://master.php.net/note/reject/87623 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#148114) next »