Skip to content

Commit

Permalink
- Add API function to throw exception by using an object
Browse files Browse the repository at this point in the history
  • Loading branch information
Andi Gutmans committed Feb 12, 2004
1 parent 71380e7 commit 559b146
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Zend/zend_execute.h
Expand Up @@ -65,6 +65,8 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);

ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC);

static inline int i_zend_is_true(zval *op)
{
int result;
Expand Down
9 changes: 9 additions & 0 deletions Zend/zend_execute_API.c
Expand Up @@ -1221,6 +1221,15 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC)
EG(current_execute_data)->opline = &EG(active_op_array)->opcodes[EG(active_op_array)->last-1-1];
}

ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC)
{
if (exception == NULL) {
zend_error(E_ERROR, "Need to supply object when throwing exception");
}
zend_throw_exception_internal(exception TSRMLS_CC);
}



ZEND_API void zend_clear_exception(TSRMLS_D)
{
Expand Down

0 comments on commit 559b146

Please sign in to comment.