static ps_module *_php_find_ps_module(char *name TSRMLS_DC);
static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC);
+static void php_session_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC)
+{
+ zend_bool do_flush;
+
+ if (mode&PHP_OUTPUT_HANDLER_END) {
+ do_flush=1;
+ }
+ session_adapt_uris(output, output_len, handled_output, handled_output_len, do_flush TSRMLS_CC);
+}
+
+
+static void php_session_start_output_handler(INIT_FUNC_ARGS, uint chunk_size)
+{
+ PHP_RINIT(url_scanner)(INIT_FUNC_ARGS_PASSTHRU);
+ PHP_RINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU);
+ php_start_ob_buffer(NULL, chunk_size TSRMLS_CC);
+ php_ob_set_internal_handler(php_session_output_handler, chunk_size TSRMLS_CC);
+}
+
+
+static void php_session_end_output_handler(SHUTDOWN_FUNC_ARGS)
+{
+ PHP_RSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
+ PHP_RSHUTDOWN(url_scanner)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
+}
+
+
static PHP_INI_MH(OnUpdateSaveHandler)
{
PS(mod) = _php_find_ps_module(new_value TSRMLS_CC);
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)
+ STD_PHP_INI_ENTRY("session.use_trans_sid", "1", PHP_INI_ALL, OnUpdateBool, use_trans_sid, 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()
php_session_start(TSRMLS_C);
}
+ if (PS(use_trans_sid)) {
+ php_session_start_output_handler(INIT_FUNC_ARGS_PASSTHRU, 4096);
+ }
+
return SUCCESS;
}
PHP_RSHUTDOWN_FUNCTION(session)
{
+ if (PS(use_trans_sid)) {
+ php_session_end_output_handler(SHUTDOWN_FUNC_ARGS_PASSTHRU);
+ }
php_session_flush(TSRMLS_C);
php_rshutdown_session_globals(TSRMLS_C);
return SUCCESS;
}
-static void php_session_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC)
-{
- zend_bool do_flush;
-
- if (mode&PHP_OUTPUT_HANDLER_END) {
- do_flush=1;
- }
- session_adapt_uris(output, output_len, handled_output, handled_output_len, do_flush TSRMLS_CC);
-}
-
-
-void php_session_start_output_handler(INIT_FUNC_ARGS, uint chunk_size)
-{
- memset(&BG(url_adapt_state), 0, sizeof(BG(url_adapt_state)));
- memset(&BG(url_adapt_state_ex), 0, sizeof(BG(url_adapt_state_ex)));
- PHP_RINIT(url_scanner)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_RINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU);
- php_start_ob_buffer(NULL, chunk_size TSRMLS_CC);
- php_ob_set_internal_handler(php_session_output_handler, chunk_size TSRMLS_CC);
-}
-
-
-void php_session_end_output_handler(SHUTDOWN_FUNC_ARGS)
-{
- PHP_RSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_RSHUTDOWN(url_scanner)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-}
-
/*
* Local variables:
* tab-width: 4
PHP_INI_BEGIN()
PHP_INI_ENTRY_EX("safe_mode_protected_env_vars", SAFE_MODE_PROTECTED_ENV_VARS, PHP_INI_SYSTEM, OnUpdateSafeModeProtectedEnvVars, NULL)
PHP_INI_ENTRY_EX("safe_mode_allowed_env_vars", SAFE_MODE_ALLOWED_ENV_VARS, PHP_INI_SYSTEM, OnUpdateSafeModeAllowedEnvVars, NULL)
- STD_PHP_INI_ENTRY("session.use_trans_sid", "1", PHP_INI_ALL, OnUpdateBool, use_trans_sid, php_basic_globals, basic_globals)
PHP_INI_END()
zend_hash_init(&BG(sm_protected_env_vars), 5, NULL, NULL, 1);
BG(sm_allowed_env_vars) = NULL;
+ memset(&BG(url_adapt_state), 0, sizeof(BG(url_adapt_state)));
+ memset(&BG(url_adapt_state_ex), 0, sizeof(BG(url_adapt_state_ex)));
+
#ifdef PHP_WIN32
CoInitialize(NULL);
#endif
PHP_RINIT(filestat)(INIT_FUNC_ARGS_PASSTHRU);
PHP_RINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU);
PHP_RINIT(dir)(INIT_FUNC_ARGS_PASSTHRU);
-
- if (BG(use_trans_sid)) {
- php_session_start_output_handler(INIT_FUNC_ARGS_PASSTHRU, 4096);
- }
-
return SUCCESS;
}
PHP_RSHUTDOWN(syslog)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
PHP_RSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- if (BG(use_trans_sid)) {
- php_session_end_output_handler(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- }
-
if (BG(user_tick_functions)) {
zend_llist_destroy(BG(user_tick_functions));
efree(BG(user_tick_functions));