params[0] = &EG(exception);
orig_user_exception_handler = EG(user_exception_handler);
if (call_user_function_ex(CG(function_table), NULL, orig_user_exception_handler, &retval2, 1, params, 1, NULL TSRMLS_CC) == SUCCESS) {
- zval_ptr_dtor(&retval2);
+ if (retval2 != NULL) {
+ zval_ptr_dtor(&retval2);
+ }
+ } else {
+ zval_ptr_dtor(&EG(exception));
+ EG(exception) = NULL;
+ zend_error(E_ERROR, "Uncaught exception!");
}
efree(params);
zval_ptr_dtor(&EG(exception));
EG(exception) = NULL;
zend_error(E_ERROR, "Uncaught exception!");
}
- if (!retval) {
+ if (retval == NULL && *EG(return_value_ptr_ptr) != NULL) {
zval_ptr_dtor(EG(return_value_ptr_ptr));
local_retval = NULL;
}