Skip to content

Commit

Permalink
Fixed segfault if throw new exception in ErrorController
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed May 30, 2014
1 parent e94ad22 commit eada946
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions yaf_dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ int yaf_dispatcher_handle(yaf_dispatcher_t *dispatcher, yaf_request_t *request,
void yaf_dispatcher_exception_handler(yaf_dispatcher_t *dispatcher, yaf_request_t *request, yaf_response_t *response TSRMLS_DC) {
zval *module, *controller, *action, *exception;
yaf_view_t *view;
zend_op *opline;

if (YAF_G(in_exception) || !EG(exception)) {
return;
Expand All @@ -808,6 +809,10 @@ void yaf_dispatcher_exception_handler(yaf_dispatcher_t *dispatcher, yaf_request_

exception = EG(exception);
EG(exception) = NULL;
opline = EG(opline_before_exception);
#if ZEND_DEBUG
EG(opline_before_exception) = NULL;
#endif

zend_update_property(yaf_request_ce, request, ZEND_STRL(YAF_REQUEST_PROPERTY_NAME_CONTROLLER), controller TSRMLS_CC);
zend_update_property(yaf_request_ce, request, ZEND_STRL(YAF_REQUEST_PROPERTY_NAME_ACTION), action TSRMLS_CC);
Expand Down Expand Up @@ -846,6 +851,7 @@ void yaf_dispatcher_exception_handler(yaf_dispatcher_t *dispatcher, yaf_request_

(void)yaf_response_send(response TSRMLS_CC);

EG(opline_before_exception) = opline;
YAF_EXCEPTION_ERASE_EXCEPTION();
}
/* }}} */
Expand Down

0 comments on commit eada946

Please sign in to comment.