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

From: Date: Wed, 07 Apr 2004 19:03:29 +0000
Subject: note 41365 added to function.session-set-save-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-67774@lists.php.net to get a copy of this message
It's really important to apply addslashes() to the serialized values passed to your custom session Write handler if you are using MySQL for storing sessions, even if you have magic_quotes turned on. Otherwise, values stored in $_SESSION will not be saved with the actual session in MySQL, or will be truncated. <? function sessWrite($key, $val) { $val = addslashes($val); // Now do your database insert here. return TRUE; } ?> Without addslashes(), the above handler would simply not work, and you will get no error back from PHP about it either. ---- Manual Page -- http://www.php.net/manual/en/function.session-set-save-handler.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41365 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41365&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41365&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67774) next »