diff options
| author | Sascha Schumann <sas@php.net> | 2000-10-11 19:47:15 +0000 |
|---|---|---|
| committer | Sascha Schumann <sas@php.net> | 2000-10-11 19:47:15 +0000 |
| commit | d2d5320ee8fac3a3bb56deda264e811f7c7e3106 (patch) | |
| tree | 3038664287f815d56eb012e8ba383ca5d4290646 /ext/session/session.c | |
| parent | 0fd6a7ed18fc23c3b90175da5167ed8d6af9e3aa (diff) | |
| download | php-git-d2d5320ee8fac3a3bb56deda264e811f7c7e3106.tar.gz | |
Add session_write_close(). This is primarily intended to enable
script writers to release the lock associated with the session lock
before the request finishes.
You can pass arrays now to session_set_save_handler(), so that the handlers
can be located in an object for better abstraction.
Diffstat (limited to 'ext/session/session.c')
| -rw-r--r-- | ext/session/session.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/ext/session/session.c b/ext/session/session.c index 33d36d17af..4ab1377dbb 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -65,6 +65,7 @@ function_entry session_functions[] = { PHP_FE(session_cache_limiter, NULL) PHP_FE(session_set_cookie_params, NULL) PHP_FE(session_get_cookie_params, NULL) + PHP_FE(session_write_close, NULL) {0} }; @@ -1082,10 +1083,10 @@ PHP_FUNCTION(session_set_save_handler) mdata = emalloc(sizeof(*mdata)); for (i = 0; i < 6; i++) { - convert_to_string_ex(args[i]); - mdata->names[i] = estrdup(Z_STRVAL_PP(args[i])); + ZVAL_ADDREF(*args[i]); + mdata->names[i] = *args[i]; } - + PS(mod_data) = (void *) mdata; RETURN_TRUE; @@ -1390,15 +1391,25 @@ PHP_RINIT_FUNCTION(session) return SUCCESS; } - -PHP_RSHUTDOWN_FUNCTION(session) +static void php_session_flush(PSLS_D) { - PSLS_FETCH(); - if (PS(nr_open_sessions) > 0) { php_session_save_current_state(PSLS_C); PS(nr_open_sessions)--; } +} + +PHP_FUNCTION(session_write_close) +{ + PSLS_FETCH(); + php_session_flush(PSLS_C); +} + +PHP_RSHUTDOWN_FUNCTION(session) +{ + PSLS_FETCH(); + + php_session_flush(PSLS_C); php_rshutdown_session_globals(PSLS_C); return SUCCESS; } |
