|
26 | 26 | #include "php.h"
|
27 | 27 | #include "php_ini.h"
|
28 | 28 | #include "ext/standard/info.h"
|
| 29 | +#include "ext/session/php_session.h" |
29 | 30 | #include "php_appserver.h"
|
30 | 31 | #include "TSRM.h"
|
31 | 32 | #include "SAPI.h"
|
@@ -57,6 +58,7 @@ const zend_function_entry appserver_functions[] = {
|
57 | 58 | PHP_FE(appserver_set_raw_post_data, NULL)
|
58 | 59 | PHP_FE(appserver_get_http_response_code, NULL)
|
59 | 60 | PHP_FE(appserver_get_envs, NULL)
|
| 61 | + PHP_FE(appserver_session_init, NULL) |
60 | 62 | PHP_FE_END
|
61 | 63 | };
|
62 | 64 |
|
@@ -329,6 +331,32 @@ PHP_FUNCTION(appserver_set_raw_post_data)
|
329 | 331 |
|
330 | 332 | }
|
331 | 333 |
|
| 334 | +/* {{{ proto boolean appserver_session_init() |
| 335 | + init session state at runtime ... /* }}} */ |
| 336 | +PHP_FUNCTION(appserver_session_init) |
| 337 | +{ |
| 338 | + if (PS(http_session_vars)) { |
| 339 | + zval_ptr_dtor(&PS(http_session_vars)); |
| 340 | + PS(http_session_vars) = NULL; |
| 341 | + } |
| 342 | + /* Do NOT destroy PS(mod_user_names) here! */ |
| 343 | + if (PS(mod_data) || PS(mod_user_implemented)) { |
| 344 | + zend_try { |
| 345 | + PS(mod)->s_close(&PS(mod_data) TSRMLS_CC); |
| 346 | + } zend_end_try(); |
| 347 | + } |
| 348 | + if (PS(id)) { |
| 349 | + efree(PS(id)); |
| 350 | + } |
| 351 | + |
| 352 | + PS(id) = NULL; |
| 353 | + PS(session_status) = php_session_none; |
| 354 | + PS(mod_data) = NULL; |
| 355 | + PS(mod_user_is_open) = 0; |
| 356 | + /* Do NOT init PS(mod_user_names) here! */ |
| 357 | + PS(http_session_vars) = NULL; |
| 358 | +} |
| 359 | + |
332 | 360 | /* {{{ proto boolean appserver_redefine(string $constant [, mixed $value])
|
333 | 361 | redefine/undefine constant at runtime ... /* }}} */
|
334 | 362 | PHP_FUNCTION(appserver_redefine)
|
|
0 commit comments