diff --git a/build.default.properties b/build.default.properties index 944bcb0..6320b70 100644 --- a/build.default.properties +++ b/build.default.properties @@ -10,9 +10,9 @@ # ---- General Settings --------------------------------------------------------- php.ext.name = appserver -release.version = 0.1.10 +release.version = 0.1.11 release.stability = beta -api.version = 0.1.10 +api.version = 0.1.11 api.stability = beta php.version = 5.6.0beta4 diff --git a/src/appserver.c b/src/appserver.c index 47248af..d23d0ab 100644 --- a/src/appserver.c +++ b/src/appserver.c @@ -26,6 +26,7 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" +#include "ext/session/php_session.h" #include "php_appserver.h" #include "TSRM.h" #include "SAPI.h" @@ -57,6 +58,7 @@ const zend_function_entry appserver_functions[] = { PHP_FE(appserver_set_raw_post_data, NULL) PHP_FE(appserver_get_http_response_code, NULL) PHP_FE(appserver_get_envs, NULL) + PHP_FE(appserver_session_init, NULL) PHP_FE_END }; @@ -329,6 +331,32 @@ PHP_FUNCTION(appserver_set_raw_post_data) } +/* {{{ proto boolean appserver_session_init() + init session state at runtime ... /* }}} */ +PHP_FUNCTION(appserver_session_init) +{ + if (PS(http_session_vars)) { + zval_ptr_dtor(&PS(http_session_vars)); + PS(http_session_vars) = NULL; + } + /* Do NOT destroy PS(mod_user_names) here! */ + if (PS(mod_data) || PS(mod_user_implemented)) { + zend_try { + PS(mod)->s_close(&PS(mod_data) TSRMLS_CC); + } zend_end_try(); + } + if (PS(id)) { + efree(PS(id)); + } + + PS(id) = NULL; + PS(session_status) = php_session_none; + PS(mod_data) = NULL; + PS(mod_user_is_open) = 0; + /* Do NOT init PS(mod_user_names) here! */ + PS(http_session_vars) = NULL; +} + /* {{{ proto boolean appserver_redefine(string $constant [, mixed $value]) redefine/undefine constant at runtime ... /* }}} */ PHP_FUNCTION(appserver_redefine) diff --git a/src/php_appserver.h b/src/php_appserver.h index 999d5ea..06d87d4 100644 --- a/src/php_appserver.h +++ b/src/php_appserver.h @@ -74,6 +74,7 @@ PHP_FUNCTION(appserver_redefine); PHP_FUNCTION(appserver_set_raw_post_data); PHP_FUNCTION(appserver_get_http_response_code); PHP_FUNCTION(appserver_get_envs); +PHP_FUNCTION(appserver_session_init); ZEND_BEGIN_MODULE_GLOBALS(appserver) appserver_llist *headers;