Skip to content

Commit

Permalink
Workaround for NuSphere Debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Mar 1, 2014
1 parent 1346450 commit 3aecf06
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 18 deletions.
22 changes: 12 additions & 10 deletions ext/session/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,18 @@ PHALCON_INIT_CLASS(Phalcon_Session_Adapter){
zend_declare_property_bool(phalcon_session_adapter_ce, SL("_started"), 0, ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(phalcon_session_adapter_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC);

phalcon_session_adapter_object_handlers = *zend_get_std_object_handlers();
phalcon_session_adapter_object_handlers.get_property_ptr_ptr = phalcon_session_adapter_get_property_ptr_ptr;
phalcon_session_adapter_object_handlers.has_property = phalcon_session_adapter_has_property;
phalcon_session_adapter_object_handlers.write_property = phalcon_session_adapter_write_property;
phalcon_session_adapter_object_handlers.unset_property = phalcon_session_adapter_unset_property;
phalcon_session_adapter_object_handlers.count_elements = phalcon_session_adapter_count_elements;
phalcon_session_adapter_object_handlers.read_dimension = phalcon_session_adapter_read_dimension;
phalcon_session_adapter_object_handlers.write_dimension = phalcon_session_adapter_write_dimension;
phalcon_session_adapter_object_handlers.has_dimension = phalcon_session_adapter_has_dimension;
phalcon_session_adapter_object_handlers.unset_dimension = phalcon_session_adapter_unset_dimension;
if (!nusphere_dbg_present) {
phalcon_session_adapter_object_handlers = *zend_get_std_object_handlers();
phalcon_session_adapter_object_handlers.get_property_ptr_ptr = phalcon_session_adapter_get_property_ptr_ptr;
phalcon_session_adapter_object_handlers.has_property = phalcon_session_adapter_has_property;
phalcon_session_adapter_object_handlers.write_property = phalcon_session_adapter_write_property;
phalcon_session_adapter_object_handlers.unset_property = phalcon_session_adapter_unset_property;
phalcon_session_adapter_object_handlers.count_elements = phalcon_session_adapter_count_elements;
phalcon_session_adapter_object_handlers.read_dimension = phalcon_session_adapter_read_dimension;
phalcon_session_adapter_object_handlers.write_dimension = phalcon_session_adapter_write_dimension;
phalcon_session_adapter_object_handlers.has_dimension = phalcon_session_adapter_has_dimension;
phalcon_session_adapter_object_handlers.unset_dimension = phalcon_session_adapter_unset_dimension;
}

phalcon_session_adapter_ce->get_iterator = phalcon_session_adapter_get_iterator;

Expand Down
46 changes: 38 additions & 8 deletions ext/session/bag.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ PHP_METHOD(Phalcon_Session_Bag, getDI){
PHP_METHOD(Phalcon_Session_Bag, initialize){

zval *session = NULL, *dependency_injector = NULL, *service;
zval *name, **data;
zval *name, **data, *tmp = NULL;

PHALCON_MM_GROW();

Expand Down Expand Up @@ -237,11 +237,17 @@ PHP_METHOD(Phalcon_Session_Bag, initialize){

name = phalcon_fetch_nproperty_this(this_ptr, SL("_name"), PH_NOISY TSRMLS_CC);

if (!nusphere_dbg_present) {
#if PHP_VERSION_ID < 50500
data = Z_OBJ_HANDLER_P(session, get_property_ptr_ptr)(session, name ZLK_NULL_CC TSRMLS_CC);
data = Z_OBJ_HANDLER_P(session, get_property_ptr_ptr)(session, name ZLK_NULL_CC TSRMLS_CC);
#else
data = Z_OBJ_HANDLER_P(session, get_property_ptr_ptr)(session, name, BP_VAR_W ZLK_NULL_CC TSRMLS_CC);
data = Z_OBJ_HANDLER_P(session, get_property_ptr_ptr)(session, name, BP_VAR_W ZLK_NULL_CC TSRMLS_CC);
#endif
}
else {
PHALCON_CALL_METHOD(&tmp, session, "__get", name);
data = &tmp;
}

if (Z_TYPE_PP(data) != IS_ARRAY) {
zval *empty_array;
Expand Down Expand Up @@ -272,7 +278,13 @@ PHP_METHOD(Phalcon_Session_Bag, destroy){

name = phalcon_fetch_nproperty_this(this_ptr, SL("_name"), PH_NOISY TSRMLS_CC);
session = phalcon_fetch_nproperty_this(this_ptr, SL("_session"), PH_NOISY TSRMLS_CC);
Z_OBJ_HANDLER_P(session, unset_property)(session, name ZLK_NULL_CC TSRMLS_CC);

if (!nusphere_dbg_present) {
Z_OBJ_HANDLER_P(session, unset_property)(session, name ZLK_NULL_CC TSRMLS_CC);
}
else {
PHALCON_CALL_METHODW(NULL, session, "__unset", name);
}
}

/**
Expand All @@ -298,7 +310,13 @@ PHP_METHOD(Phalcon_Session_Bag, set){
name = phalcon_fetch_nproperty_this(this_ptr, SL("_name"), PH_NOISY TSRMLS_CC);
data = phalcon_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY TSRMLS_CC);
session = phalcon_fetch_nproperty_this(this_ptr, SL("_session"), PH_NOISY TSRMLS_CC);
Z_OBJ_HANDLER_P(session, write_property)(session, name, data ZLK_NULL_CC TSRMLS_CC);

if (!nusphere_dbg_present) {
Z_OBJ_HANDLER_P(session, write_property)(session, name, data ZLK_NULL_CC TSRMLS_CC);
}
else {
PHALCON_CALL_METHODW(NULL, session, "__set", name, data);
}
}

/**
Expand Down Expand Up @@ -386,7 +404,12 @@ PHP_METHOD(Phalcon_Session_Bag, __get)
name = phalcon_fetch_nproperty_this(this_ptr, SL("_name"), PH_NOISY TSRMLS_CC);
data = phalcon_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY TSRMLS_CC);
session = phalcon_fetch_nproperty_this(this_ptr, SL("_session"), PH_NOISY TSRMLS_CC);
Z_OBJ_HANDLER_P(session, write_property)(session, name, data ZLK_NULL_CC TSRMLS_CC);
if (!nusphere_dbg_present) {
Z_OBJ_HANDLER_P(session, write_property)(session, name, data ZLK_NULL_CC TSRMLS_CC);
}
else {
PHALCON_CALL_METHODW(NULL, session, "__set", name, data);
}
}

Z_ADDREF_PP(return_value_ptr);
Expand Down Expand Up @@ -454,10 +477,17 @@ PHP_METHOD(Phalcon_Session_Bag, remove){
data = phalcon_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY TSRMLS_CC);
name = phalcon_fetch_nproperty_this(this_ptr, SL("_name"), PH_NOISY TSRMLS_CC);
session = phalcon_fetch_nproperty_this(this_ptr, SL("_session"), PH_NOISY TSRMLS_CC);
Z_OBJ_HANDLER_P(session, write_property)(session, name, data ZLK_NULL_CC TSRMLS_CC);

if (!nusphere_dbg_present) {
Z_OBJ_HANDLER_P(session, write_property)(session, name, data ZLK_NULL_CC TSRMLS_CC);
}
else {
PHALCON_CALL_METHODW(NULL, session, "__set", name, data);
}

RETURN_TRUE;
}

RETURN_FALSE;
}

Expand Down

0 comments on commit 3aecf06

Please sign in to comment.