summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2009-01-02 13:14:17 +0000
committerMarcus Boerger <helly@php.net>2009-01-02 13:14:17 +0000
commitebd735786c67b2afc7cb67da3973675fe2e45c59 (patch)
tree35839aff02dceaa9d4feec94d063cf3af063e485 /Zend
parentbe8d3a6ebe690078f7e2954e4d3330e034990478 (diff)
downloadphp-git-ebd735786c67b2afc7cb67da3973675fe2e45c59.tar.gz
- Catch exceptions in cli -a
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend.c4
-rw-r--r--Zend/zend_exceptions.c8
-rw-r--r--Zend/zend_exceptions.h4
-rw-r--r--Zend/zend_execute_API.c4
4 files changed, 10 insertions, 10 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 6c2bea66c6..65d874d098 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -1728,10 +1728,10 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
}
} else {
zend_exception_restore(TSRMLS_C);
- zend_exception_error(EG(exception) TSRMLS_CC);
+ zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
}
} else {
- zend_exception_error(EG(exception) TSRMLS_CC);
+ zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
}
}
destroy_op_array(EG(active_op_array) TSRMLS_CC);
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index c2ab940eab..ee638b8c8a 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -817,8 +817,8 @@ static void zend_error_va(int type, const char *file, uint lineno, const char *f
}
/* }}} */
-/* This function doesn't return as it calls E_ERROR */
-ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) /* {{{ */
+/* This function doesn't return if it uses E_ERROR */
+ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce_exception = Z_OBJCE_P(exception);
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
@@ -861,10 +861,10 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) /* {{{ */
zend_error_va(E_ERROR, Z_STRVAL(copy), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str));
zval_dtor(&copy);
} else {
- zend_error_va(E_ERROR, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str));
+ zend_error_va(severity, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str));
}
} else {
- zend_error(E_ERROR, "Uncaught exception '%v'", ce_exception->name);
+ zend_error(severity, "Uncaught exception '%v'", ce_exception->name);
}
}
/* }}} */
diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h
index 9b969f3143..2eeba22765 100644
--- a/Zend/zend_exceptions.h
+++ b/Zend/zend_exceptions.h
@@ -49,8 +49,8 @@ ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char
extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
-/* show an exception using zend_error(E_ERROR,...) */
-ZEND_API void zend_exception_error(zval *exception TSRMLS_DC);
+/* show an exception using zend_error(severity,...), severity should be E_ERROR */
+ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC);
/* do not export, in php it's available thru spprintf directly */
int zend_spprintf(char **message, int max_len, char *format, ...);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 5a4e8df52e..53873b16e8 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1312,7 +1312,7 @@ ZEND_API int zend_u_eval_string_ex(zend_uchar type, zstr str, zval *retval_ptr,
result = zend_u_eval_string(type, str, retval_ptr, string_name TSRMLS_CC);
if (handle_exceptions && EG(exception)) {
- zend_exception_error(EG(exception) TSRMLS_CC);
+ zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
result = FAILURE;
}
return result;
@@ -1387,7 +1387,7 @@ void execute_new_code(TSRMLS_D) /* {{{ */
zend_execute(CG(active_op_array) TSRMLS_CC);
if (EG(exception)) {
- zend_exception_error(EG(exception) TSRMLS_CC);
+ zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
}
CG(active_op_array)->last -= 1; /* get rid of that ZEND_RETURN */