From: Sascha Schumann Date: Tue, 18 Feb 2003 18:50:44 +0000 (+0000) Subject: add session_regenerate_id() X-Git-Tag: RELEASE_0_5~903 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32e0c8161ca28adc16e651c0f106b69c2d1f6403;p=php add session_regenerate_id() --- diff --git a/ext/session/php_session.h b/ext/session/php_session.h index 72b67c6a53..4e850807ec 100644 --- a/ext/session/php_session.h +++ b/ext/session/php_session.h @@ -132,6 +132,7 @@ PHP_FUNCTION(session_name); PHP_FUNCTION(session_module_name); PHP_FUNCTION(session_save_path); PHP_FUNCTION(session_id); +PHP_FUNCTION(session_regenerate_id); PHP_FUNCTION(session_decode); PHP_FUNCTION(session_register); PHP_FUNCTION(session_unregister); diff --git a/ext/session/session.c b/ext/session/session.c index d575474cbc..74398b261d 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -61,6 +61,7 @@ function_entry session_functions[] = { PHP_FE(session_module_name, NULL) PHP_FE(session_save_path, NULL) PHP_FE(session_id, NULL) + PHP_FE(session_regenerate_id, NULL) PHP_FE(session_decode, NULL) PHP_FE(session_register, NULL) PHP_FE(session_unregister, NULL) @@ -1358,6 +1359,20 @@ PHP_FUNCTION(session_id) } /* }}} */ +/* {{{ proto string session_regenerate_id() + Update the current session id with a newly generated one. */ +PHP_FUNCTION(session_regenerate_id) +{ + if (PS(mod)) { + if (PS(id)) efree(PS(id)); + + PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC); + RETURN_TRUE; + } + RETURN_FALSE; +} +/* }}} */ + /* {{{ proto string session_cache_limiter([string new_cache_limiter]) Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter */ PHP_FUNCTION(session_cache_limiter)