Skip to content

Commit

Permalink
Use session_write_close() in Phalcon\Session\Adapter::__destruct()
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Dec 20, 2013
1 parent a648b42 commit cfd1909
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ext/session/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ PHP_METHOD(Phalcon_Session_Adapter, __construct){
PHALCON_MM_RESTORE();
}

PHP_METHOD(Phalcon_Session_Adapter, __destruct) {

zval *started;

started = phalcon_fetch_nproperty_this(getThis(), SL("_started"), PH_NOISY TSRMLS_CC);
if (zend_is_true(started)) {
phalcon_session_write_close(TSRMLS_C);
phalcon_update_property_bool(this_ptr, SL("_started"), 0 TSRMLS_CC);
}
}

/**
* Starts the session (if headers are already sent the session will not be started)
*
Expand Down
2 changes: 2 additions & 0 deletions ext/session/adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extern zend_class_entry *phalcon_session_adapter_ce;
PHALCON_INIT_CLASS(Phalcon_Session_Adapter);

PHP_METHOD(Phalcon_Session_Adapter, __construct);
PHP_METHOD(Phalcon_Session_Adapter, __destruct);
PHP_METHOD(Phalcon_Session_Adapter, start);
PHP_METHOD(Phalcon_Session_Adapter, setOptions);
PHP_METHOD(Phalcon_Session_Adapter, getOptions);
Expand Down Expand Up @@ -62,6 +63,7 @@ ZEND_END_ARG_INFO()

PHALCON_INIT_FUNCS(phalcon_session_adapter_method_entry){
PHP_ME(Phalcon_Session_Adapter, __construct, arginfo_phalcon_session_adapter___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_ME(Phalcon_Session_Adapter, __destruct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_DTOR)
PHP_ME(Phalcon_Session_Adapter, start, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Session_Adapter, setOptions, arginfo_phalcon_session_adapter_setoptions, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Session_Adapter, getOptions, NULL, ZEND_ACC_PUBLIC)
Expand Down

0 comments on commit cfd1909

Please sign in to comment.