summaryrefslogtreecommitdiff
path: root/ext/session
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-05-26 11:12:49 +0000
committerZeev Suraski <zeev@php.net>2000-05-26 11:12:49 +0000
commitfb69f854aff36433e0dfc7878e001b3a33472400 (patch)
treeb5bed5ffe3f7723fa69446c8c62dc8f26b22ab6d /ext/session
parent8e12a0126e4c7f5045bca98883b040e32b64347f (diff)
downloadphp-git-fb69f854aff36433e0dfc7878e001b3a33472400.tar.gz
Use the INI framework in the session module
Diffstat (limited to 'ext/session')
-rw-r--r--ext/session/php_session.h17
-rw-r--r--ext/session/session.c45
2 files changed, 29 insertions, 33 deletions
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index a93f4d87f4..9e50e626bd 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -77,22 +77,25 @@ typedef struct {
char *extern_referer_chk;
char *entropy_file;
char *cache_limiter;
- int entropy_length;
- int cookie_lifetime;
+ long entropy_length;
+ long cookie_lifetime;
char *cookie_path;
char *cookie_domain;
- zend_bool define_sid;
- zend_bool use_cookies;
ps_module *mod;
void *mod_data;
HashTable vars;
int nr_open_sessions;
- int gc_probability;
- int gc_maxlifetime;
+ long gc_probability;
+ long gc_maxlifetime;
int module_number;
- int cache_expire;
+ long cache_expire;
const struct ps_serializer_struct *serializer;
zval *http_session_vars;
+ char *serialize_handler;
+ char *save_handler;
+ zend_bool auto_start;
+ zend_bool define_sid;
+ zend_bool use_cookies;
} php_ps_globals;
extern zend_module_entry session_module_entry;
diff --git a/ext/session/session.c b/ext/session/session.c
index 32c3db5c61..366bf076ff 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -68,22 +68,22 @@ function_entry session_functions[] = {
};
PHP_INI_BEGIN()
- PHP_INI_ENTRY("session.save_path", "/tmp", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.auto_start", "0", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.gc_probability", "1", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.gc_maxlifetime", "1440", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.serialize_handler", "php", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.cookie_lifetime", "0", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.cookie_path", "/", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.cookie_domain", "", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.use_cookies", "1", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.entropy_file", "", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.entropy_length", "0", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.cache_limiter", "nocache", PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("session.cache_expire", "180", PHP_INI_ALL, NULL)
+ STD_PHP_INI_ENTRY("session.save_path", "/tmp", PHP_INI_ALL, OnUpdateString, save_path, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateString, session_name, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, OnUpdateString, save_handler, php_ps_globals, ps_globals)
+ STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_ALL, OnUpdateBool, auto_start, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.gc_probability", "1", PHP_INI_ALL, OnUpdateInt, gc_probability, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.gc_maxlifetime", "1440", PHP_INI_ALL, OnUpdateInt, gc_maxlifetime, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.serialize_handler", "php", PHP_INI_ALL, OnUpdateString, serialize_handler, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.cookie_lifetime", "0", PHP_INI_ALL, OnUpdateInt, cookie_lifetime, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.cookie_path", "/", PHP_INI_ALL, OnUpdateString, cookie_path, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.cookie_domain", "", PHP_INI_ALL, OnUpdateString, cookie_domain, php_ps_globals, ps_globals)
+ STD_PHP_INI_BOOLEAN("session.use_cookies", "1", PHP_INI_ALL, OnUpdateBool, use_cookies, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, OnUpdateString, extern_referer_chk, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.entropy_file", "", PHP_INI_ALL, OnUpdateString, entropy_file, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.entropy_length", "0", PHP_INI_ALL, OnUpdateInt, 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, OnUpdateInt, cache_expire, php_ps_globals, ps_globals)
/* Commented out until future discussion */
/* PHP_INI_ENTRY("session.encode_sources", "globals,track", PHP_INI_ALL, NULL) */
PHP_INI_END()
@@ -1229,26 +1229,19 @@ PHP_FUNCTION(session_unset)
static void php_rinit_session_globals(PSLS_D)
{
- PS(mod) = _php_find_ps_module(INI_STR("session.save_handler") PSLS_CC);
- PS(serializer) = \
- _php_find_ps_serializer(INI_STR("session.serialize_handler") PSLS_CC);
+ PS(mod) = _php_find_ps_module(PS(save_handler) PSLS_CC);
+ PS(serializer) = _php_find_ps_serializer(PS(serialize_handler) PSLS_CC);
zend_hash_init(&PS(vars), 0, NULL, NULL, 0);
PS(define_sid) = 0;
- PS(use_cookies) = INI_BOOL("session.use_cookies");
PS(save_path) = estrdup(INI_STR("session.save_path"));
PS(session_name) = estrdup(INI_STR("session.name"));
PS(entropy_file) = estrdup(INI_STR("session.entropy_file"));
- PS(entropy_length) = INI_INT("session.entropy_length");
- PS(gc_probability) = INI_INT("session.gc_probability");
- PS(gc_maxlifetime) = INI_INT("session.gc_maxlifetime");
PS(extern_referer_chk) = estrdup(INI_STR("session.referer_check"));
PS(id) = NULL;
- PS(cookie_lifetime) = INI_INT("session.cookie_lifetime");
PS(cookie_path) = estrdup(INI_STR("session.cookie_path"));
PS(cookie_domain) = estrdup(INI_STR("session.cookie_domain"));
PS(cache_limiter) = estrdup(INI_STR("session.cache_limiter"));
- PS(cache_expire) = INI_INT("session.cache_expire");
PS(nr_open_sessions) = 0;
PS(mod_data) = NULL;
}
@@ -1282,7 +1275,7 @@ PHP_RINIT_FUNCTION(session)
return SUCCESS;
}
- if (INI_INT("session.auto_start"))
+ if (PS(auto_start))
_php_session_start(PSLS_C);
return SUCCESS;