Skip to content

Commit eada946

Browse files
committed
Fixed segfault if throw new exception in ErrorController
1 parent e94ad22 commit eada946

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

yaf_dispatcher.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,7 @@ int yaf_dispatcher_handle(yaf_dispatcher_t *dispatcher, yaf_request_t *request,
786786
void yaf_dispatcher_exception_handler(yaf_dispatcher_t *dispatcher, yaf_request_t *request, yaf_response_t *response TSRMLS_DC) {
787787
zval *module, *controller, *action, *exception;
788788
yaf_view_t *view;
789+
zend_op *opline;
789790

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

809810
exception = EG(exception);
810811
EG(exception) = NULL;
812+
opline = EG(opline_before_exception);
813+
#if ZEND_DEBUG
814+
EG(opline_before_exception) = NULL;
815+
#endif
811816

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

847852
(void)yaf_response_send(response TSRMLS_CC);
848853

854+
EG(opline_before_exception) = opline;
849855
YAF_EXCEPTION_ERASE_EXCEPTION();
850856
}
851857
/* }}} */

0 commit comments

Comments
 (0)