diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2003-12-14 23:24:50 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2003-12-14 23:24:50 +0000 |
commit | d3639b1aa7948f9abaf4df67b133b0d005428fdc (patch) | |
tree | 8da73061d7291dad863a4145ea0cfda30bee78f0 | |
parent | 661b203e89e87278bf3413b79c945dd55aa2df32 (diff) | |
download | php-git-d3639b1aa7948f9abaf4df67b133b0d005428fdc.tar.gz |
Fixed bug #24693 (Allow session.use_trans_sid to be enabled/disabled from
inside the script).
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/session/session.c | 33 |
2 files changed, 26 insertions, 9 deletions
@@ -47,6 +47,8 @@ PHP NEWS has no properties (NULL hashtable)). (Wez) - Fixed bug #25664 (COM crashes when calling a Delphi implementations of ITypeInfo). (Wez) +- Fixed bug #24693 (Allow session.use_trans_sid to be enabled/disabled from + inside the script). (Ilia) - Fixed bug #24394 (Serializing cross-referenced objects causes segfault). (Moriyoshi) diff --git a/ext/session/session.c b/ext/session/session.c index 50636f042a..4517a0f04e 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -86,12 +86,16 @@ ZEND_DECLARE_MODULE_GLOBALS(ps); static ps_module *_php_find_ps_module(char *name TSRMLS_DC); static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC); +#define SESSION_CHECK_ACTIVE_STATE \ + if (PS(session_status) == php_session_active) { \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "A session is active. You cannot change the session module's ini settings at this time."); \ + return FAILURE; \ + } \ + static PHP_INI_MH(OnUpdateSaveHandler) { - if (PS(session_status) == php_session_active) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "A session is active. You cannot change the session module's ini settings at this time."); - return FAILURE; - } + SESSION_CHECK_ACTIVE_STATE; + PS(mod) = _php_find_ps_module(new_value TSRMLS_CC); if (PG(modules_activated) && !PS(mod)) { @@ -101,12 +105,23 @@ static PHP_INI_MH(OnUpdateSaveHandler) return SUCCESS; } -static PHP_INI_MH(OnUpdateSerializer) +static PHP_INI_MH(OnUpdateTransSid) { - if (PS(session_status) == php_session_active) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "A session is active. You cannot change the session module's ini settings at this time."); - return FAILURE; + SESSION_CHECK_ACTIVE_STATE; + + if (!strncasecmp(new_value, "on", sizeof("on"))) { + PS(use_trans_sid) = (zend_bool) 1; + } else { + PS(use_trans_sid) = (zend_bool) atoi(new_value); } + + return SUCCESS; +} + +static PHP_INI_MH(OnUpdateSerializer) +{ + SESSION_CHECK_ACTIVE_STATE; + PS(serializer) = _php_find_ps_serializer(new_value TSRMLS_CC); if (PG(modules_activated) && !PS(serializer)) { @@ -141,7 +156,7 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("session.entropy_length", "0", PHP_INI_ALL, OnUpdateLong, entropy_length, php_ps_globals, ps_globals) STD_PHP_INI_ENTRY("session.cache_limiter", "nocache", PHP_INI_ALL, OnUpdateString, cache_limiter, php_ps_globals, ps_globals) STD_PHP_INI_ENTRY("session.cache_expire", "180", PHP_INI_ALL, OnUpdateLong, cache_expire, php_ps_globals, ps_globals) - STD_PHP_INI_BOOLEAN("session.use_trans_sid", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, use_trans_sid, php_ps_globals, ps_globals) + PHP_INI_ENTRY("session.use_trans_sid", "0", PHP_INI_ALL, OnUpdateTransSid) STD_PHP_INI_ENTRY("session.hash_function", "0", PHP_INI_ALL, OnUpdateLong, hash_func, php_ps_globals, ps_globals) STD_PHP_INI_ENTRY("session.hash_bits_per_character", "4", PHP_INI_ALL, OnUpdateLong, hash_bits_per_character, php_ps_globals, ps_globals) |