Skip to content

Commit

Permalink
Merge pull request #21 from zelgerj/master
Browse files Browse the repository at this point in the history
added appserver_session_init function
  • Loading branch information
zelgerj committed Jun 20, 2014
2 parents 9b39c14 + bfa0f00 commit 7916977
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 28 additions & 0 deletions src/appserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
};

Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/php_appserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7916977

Please sign in to comment.