} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot encode non-existent session");
}
-
return ret;
}
/* }}} */
if (PG(modules_activated) && !tmp) {
int err_type;
+
if (stage == ZEND_INI_STAGE_RUNTIME) {
err_type = E_WARNING;
} else {
{
/* Only do the safemode/open_basedir check at runtime */
if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) {
- char *p;
+ char *p;
if (memchr(new_value, '\0', new_value_length) != NULL) {
return FAILURE;
STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateString, session_name, php_ps_globals, ps_globals)
PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, OnUpdateSaveHandler)
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, OnUpdateLong, gc_probability, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.gc_divisor", "100", PHP_INI_ALL, OnUpdateLong, gc_divisor, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.gc_maxlifetime", "1440", PHP_INI_ALL, OnUpdateLong, gc_maxlifetime, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.gc_probability", "1", PHP_INI_ALL, OnUpdateLong, gc_probability, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.gc_divisor", "100", PHP_INI_ALL, OnUpdateLong, gc_divisor, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.gc_maxlifetime", "1440", PHP_INI_ALL, OnUpdateLong, gc_maxlifetime, php_ps_globals, ps_globals)
PHP_INI_ENTRY("session.serialize_handler", "php", PHP_INI_ALL, OnUpdateSerializer)
- STD_PHP_INI_ENTRY("session.cookie_lifetime", "0", PHP_INI_ALL, OnUpdateLong, cookie_lifetime, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.cookie_lifetime", "0", PHP_INI_ALL, OnUpdateLong, 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.cookie_secure", "", PHP_INI_ALL, OnUpdateBool, cookie_secure, php_ps_globals, ps_globals)
STD_PHP_INI_BOOLEAN("session.use_only_cookies", "1", PHP_INI_ALL, OnUpdateBool, use_only_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, OnUpdateLong, entropy_length, php_ps_globals, ps_globals)
+ 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)
- PHP_INI_ENTRY("session.use_trans_sid", "0", PHP_INI_ALL, OnUpdateTransSid)
- PHP_INI_ENTRY("session.hash_function", "0", PHP_INI_ALL, OnUpdateHashFunc)
- STD_PHP_INI_ENTRY("session.hash_bits_per_character", "4", PHP_INI_ALL, OnUpdateLong, hash_bits_per_character, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.cache_expire", "180", PHP_INI_ALL, OnUpdateLong, cache_expire, php_ps_globals, ps_globals)
+ PHP_INI_ENTRY("session.use_trans_sid", "0", PHP_INI_ALL, OnUpdateTransSid)
+ PHP_INI_ENTRY("session.hash_function", "0", PHP_INI_ALL, OnUpdateHashFunc)
+ STD_PHP_INI_ENTRY("session.hash_bits_per_character", "4", PHP_INI_ALL, OnUpdateLong, hash_bits_per_character, php_ps_globals, ps_globals)
/* Commented out until future discussion */
/* PHP_INI_ENTRY("session.encode_sources", "globals,track", PHP_INI_ALL, NULL) */
PHP_VAR_SERIALIZE_INIT(var_hash);
PS_UENCODE_LOOP(
- if (key_length > PS_BIN_MAX || key_type != HASH_KEY_IS_STRING) continue;
- if (struc) {
- smart_str_appendc(&buf, (unsigned char)key_length );
- smart_str_appendl(&buf, key.s, key_length);
- php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
- } else {
- smart_str_appendc(&buf, (unsigned char)key_length | PS_BIN_UNDEF);
- smart_str_appendl(&buf, key.s, key_length);
- }
+ if (key_length > PS_BIN_MAX || key_type != HASH_KEY_IS_STRING) continue;
+ if (struc) {
+ smart_str_appendc(&buf, (unsigned char)key_length );
+ smart_str_appendl(&buf, key.s, key_length);
+ php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
+ } else {
+ smart_str_appendc(&buf, (unsigned char)key_length | PS_BIN_UNDEF);
+ smart_str_appendl(&buf, key.s, key_length);
+ }
);
if (newlen) {
zval **tmp;
namelen = ((unsigned char)(*p)) & (~PS_BIN_UNDEF);
- if (namelen > PS_BIN_MAX || (p + namelen) >= endptr) {
+ if (namelen < 0 || namelen > PS_BIN_MAX || (p + namelen) >= endptr) {
return FAILURE;
}
if ((Z_TYPE_PP(tmp) == IS_ARRAY && Z_ARRVAL_PP(tmp) == &EG(symbol_table)) || *tmp == PS(http_session_vars)) {
efree(name);
continue;
- }
- }
+ }
+ }
if (has_value) {
ALLOC_INIT_ZVAL(current);
zval_ptr_dtor(¤t);
}
}
-
PS_ADD_VARL(name, namelen);
efree(name);
}
}
);
- if (newlen) *newlen = buf.len;
-
+ if (newlen) {
+ *newlen = buf.len;
+ }
smart_str_0(&buf);
*newstr = buf.c;
if (zend_hash_find(&EG(symbol_table), name, namelen + 1, (void **) &tmp) == SUCCESS) {
if ((Z_TYPE_PP(tmp) == IS_ARRAY && Z_ARRVAL_PP(tmp) == &EG(symbol_table)) || *tmp == PS(http_session_vars)) {
goto skip;
- }
- }
+ }
+ }
if (has_value) {
ALLOC_INIT_ZVAL(current);
break;
}
}
-
return ret;
}
/* }}} */
+
/* *******************
* Storage Modules *
******************* */
return;
}
- n = snprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", /* SAFE */
+ n = slprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", /* SAFE */
week_days[tm.tm_wday], tm.tm_mday,
month_names[tm.tm_mon], tm.tm_year + 1900,
tm.tm_hour, tm.tm_min,
break;
}
}
-
return ret;
}
/* }}} */
break;
}
}
-
return ret;
}
/* }}} */
value = zend_ini_string("session.save_handler", sizeof("session.save_handler"), 0);
- if (value) {
+ if (value) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot find save handler %s", value);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot find unknown save handler");
}
return;
}
-
php_error(E_NOTICE, "A session had already been started - ignoring session_start()");
return;
} else {
lensess = strlen(PS(session_name));
-
/*
* Cookies are preferred, because initially
* cookie and get variables will be available.
/* {{{ proto void session_set_cookie_params(int lifetime [, string path [, string domain [, bool secure[, bool httponly]]]]) U
Set session cookie parameters */
-static PHP_FUNCTION(session_set_cookie_params) /* {{{ */
+static PHP_FUNCTION(session_set_cookie_params)
{
/* lifetime is really a numeric, but the alter_ini_entry method wants a string */
char *lifetime, *path = NULL, *domain = NULL;
/* {{{ proto array session_get_cookie_params(void) U
Return the session cookie parameters */
-static PHP_FUNCTION(session_get_cookie_params) /* {{{ */
+static PHP_FUNCTION(session_get_cookie_params)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
/* {{{ proto string session_name([string newname]) U
Return the current session name. If newname is given, the session name is replaced with newname */
-static PHP_FUNCTION(session_name) /* {{{ */
+static PHP_FUNCTION(session_name)
{
char *name = NULL;
int name_len;
/* {{{ proto string session_module_name([string newname]) U
Return the current module name used for accessing session data. If newname is given, the module name is replaced with newname */
-static PHP_FUNCTION(session_module_name) /* {{{ */
+static PHP_FUNCTION(session_module_name)
{
char *name = NULL;
int name_len;
/* {{{ proto void session_set_save_handler(string open, string close, string read, string write, string destroy, string gc) U
Sets user-level functions */
-static PHP_FUNCTION(session_set_save_handler) /* {{{ */
+static PHP_FUNCTION(session_set_save_handler)
{
zval **args[6];
int i;
/* {{{ proto string session_save_path([string newname]) U
Return the current save path passed to module_name. If newname is given, the save path is replaced with newname */
-static PHP_FUNCTION(session_save_path) /* {{{ */
+static PHP_FUNCTION(session_save_path)
{
char *name = NULL;
int name_len;