Skip to content

Commit

Permalink
Partial backport of phalcon#1137; Fix phalcon#1131
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Oct 6, 2013
1 parent 812047a commit 28189e9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
17 changes: 11 additions & 6 deletions ext/events/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ PHP_METHOD(Phalcon_Events_Manager, getResponses){
*
* @param string $type
*/
PHP_METHOD(Phalcon_Events_Manager, dettachAll){
PHP_METHOD(Phalcon_Events_Manager, detachAll){

zval *type = NULL, *events = NULL, *null_value;
zval *type = NULL, *events = NULL;

PHALCON_MM_GROW();

Expand All @@ -249,17 +249,22 @@ PHP_METHOD(Phalcon_Events_Manager, dettachAll){
if (Z_TYPE_P(type) == IS_NULL) {
PHALCON_INIT_NVAR(events);
} else {
if (phalcon_array_isset(events, type)) {
PHALCON_INIT_VAR(null_value);
phalcon_array_update_zval(&events, type, &null_value, PH_COPY | PH_SEPARATE);
}
phalcon_array_unset(&events, type, PH_SEPARATE);
}

phalcon_update_property_this(this_ptr, SL("_events"), events TSRMLS_CC);

PHALCON_MM_RESTORE();
}

/**
* Removes all events from the EventsManager; alias of detachAll
*
* @deprecated
* @param string $type
*/
PHALCON_DOC_METHOD(Phalcon_Events_Manager, dettachAll)

/**
* Internal handler to call a queue of events
*
Expand Down
7 changes: 4 additions & 3 deletions ext/events/manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ PHP_METHOD(Phalcon_Events_Manager, arePrioritiesEnabled);
PHP_METHOD(Phalcon_Events_Manager, collectResponses);
PHP_METHOD(Phalcon_Events_Manager, isCollecting);
PHP_METHOD(Phalcon_Events_Manager, getResponses);
PHP_METHOD(Phalcon_Events_Manager, dettachAll);
PHP_METHOD(Phalcon_Events_Manager, detachAll);
PHP_METHOD(Phalcon_Events_Manager, fireQueue);
PHP_METHOD(Phalcon_Events_Manager, fire);
PHP_METHOD(Phalcon_Events_Manager, hasListeners);
Expand All @@ -47,7 +47,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_events_manager_collectresponses, 0, 0, 1)
ZEND_ARG_INFO(0, collect)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_events_manager_dettachall, 0, 0, 0)
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_events_manager_detachall, 0, 0, 0)
ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO()

Expand Down Expand Up @@ -78,7 +78,8 @@ PHALCON_INIT_FUNCS(phalcon_events_manager_method_entry){
PHP_ME(Phalcon_Events_Manager, collectResponses, arginfo_phalcon_events_manager_collectresponses, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Events_Manager, isCollecting, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Events_Manager, getResponses, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Events_Manager, dettachAll, arginfo_phalcon_events_manager_dettachall, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Events_Manager, detachAll, arginfo_phalcon_events_manager_detachall, ZEND_ACC_PUBLIC)
PHP_MALIAS(Phalcon_Events_Manager, dettachAll, detachAll, arginfo_phalcon_events_manager_detachall, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED)
PHP_ME(Phalcon_Events_Manager, fireQueue, arginfo_phalcon_events_manager_firequeue, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Events_Manager, fire, arginfo_phalcon_events_manager_fire, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Events_Manager, hasListeners, arginfo_phalcon_events_manager_haslisteners, ZEND_ACC_PUBLIC)
Expand Down

0 comments on commit 28189e9

Please sign in to comment.