summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_exceptions.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 1f47d88997..f037f0399a 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -92,11 +92,10 @@ void zend_exception_set_previous(zend_object *exception, zend_object *add_previo
return;
}
+ ZEND_ASSERT(instanceof_function(add_previous->ce, zend_ce_throwable)
+ && "Previous execption must implement Throwable");
+
ZVAL_OBJ(&pv, add_previous);
- if (!instanceof_function(Z_OBJCE(pv), zend_ce_throwable)) {
- zend_error_noreturn(E_CORE_ERROR, "Previous exception must implement Throwable");
- return;
- }
ZVAL_OBJ(&zv, exception);
ex = &zv;
do {
@@ -837,16 +836,14 @@ static zend_object *zend_throw_exception_zstr(zend_class_entry *exception_ce, ze
{
zval ex, tmp;
- if (exception_ce) {
- if (!instanceof_function(exception_ce, zend_ce_throwable)) {
- zend_error(E_NOTICE, "Exceptions must implement Throwable");
- exception_ce = zend_ce_exception;
- }
- } else {
+ if (!exception_ce) {
exception_ce = zend_ce_exception;
}
- object_init_ex(&ex, exception_ce);
+ ZEND_ASSERT(instanceof_function(exception_ce, zend_ce_throwable)
+ && "Exceptions must implement Throwable");
+
+ object_init_ex(&ex, exception_ce);
if (message) {
ZVAL_STR(&tmp, message);