note 51737 deleted from function.session-regenerate-id by nlopess
| From: | nlopess@php.net | Date: | Sat, 09 Apr 2005 08:44:11 +0000 |
| Subject: | note 51737 deleted from function.session-regenerate-id by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-87751@lists.php.net to get a copy of this message | ||
Note Submitter: mjs15451 at hotmail dot com
----
For everyone who doesn't like the fact that session_regenerate_id doesn't delete the old
session file, I took it upon myself to modify the source. Just modify delete the old
PHP_FUNCTION(session_regenerate_id) function in your session.c file and replace it with my modded
version (obviously you will need to recompile php after you change this file):
PHP_FUNCTION(session_regenerate_id)
{
char *oldID = empty_string;
if (PS(session_status) == php_session_active) {
if (PS(id)) {
oldID = PS(id); //save old id
efree(PS(id));
}
PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);
php_session_reset_id(TSRMLS_C);
if (oldID != empty_string) PS(mod)->s_destroy(&PS(mod_data), oldID
TSRMLS_CC); //delete old session file
RETURN_TRUE;
}
RETURN_FALSE;
}