]> granicus.if.org Git - php/commitdiff
Enable throwing custom exceptions from errors
authorAaron Piotrowski <aaron@trowski.com>
Fri, 3 Jul 2015 18:41:17 +0000 (13:41 -0500)
committerAaron Piotrowski <aaron@trowski.com>
Fri, 3 Jul 2015 22:53:40 +0000 (17:53 -0500)
16 files changed:
Zend/zend.c
Zend/zend.h
Zend/zend_API.c
Zend/zend_ast.c
Zend/zend_closures.c
Zend/zend_constants.c
Zend/zend_exceptions.c
Zend/zend_execute.c
Zend/zend_execute_API.c
Zend/zend_generators.c
Zend/zend_interfaces.c
Zend/zend_object_handlers.c
Zend/zend_objects.c
Zend/zend_operators.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index e824b75c8db8e398abaeb60b36906342e5d2e751..b60a60413e96a2bfbd6bc04f6813ca4f1b022b2c 100644 (file)
@@ -1049,25 +1049,6 @@ static void zend_error_va_list(int type, const char *format, va_list args)
        zend_stack delayed_oplines_stack;
        zend_array *symbol_table;
 
-       if (type & E_EXCEPTION) {
-               type &= ~E_EXCEPTION;
-               //TODO: we can't convert compile-time errors to exceptions yet???
-               if (EG(current_execute_data) && !CG(in_compilation)) {
-                       char *message = NULL;
-
-#if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
-                       va_start(args, format);
-#endif
-                       zend_vspprintf(&message, 0, format, args);
-                       zend_throw_exception(zend_ce_error, message, type);
-                       efree(message);
-#if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
-                       va_end(args);
-#endif
-                       return;
-               }
-       }
-
        /* Report about uncaught exception in case of fatal errors */
        if (EG(exception)) {
                zend_execute_data *ex;
@@ -1311,6 +1292,31 @@ ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ..
 # endif
 #endif
 
+ZEND_API void zend_throw_error(zend_class_entry *exception_ce, int type, const char *format, ...) /* {{{ */
+{
+       va_list va;
+       char *message = NULL;
+       
+       va_start(va, format);
+       zend_vspprintf(&message, 0, format, va);
+
+       if (type & E_EXCEPTION) {
+               type = E_ERROR; // Convert to E_ERROR if unable to throw.
+               //TODO: we can't convert compile-time errors to exceptions yet???
+               if (EG(current_execute_data) && !CG(in_compilation)) {
+                       zend_throw_exception(exception_ce, message, type);
+                       efree(message);
+                       va_end(va);
+                       return;
+               }
+       }
+       
+       zend_error(type, message);
+       efree(message);
+       va_end(va);
+}
+/* }}} */
+
 ZEND_API void zend_type_error(const char *format, ...) /* {{{ */
 {
        va_list va;
index a9e65ae7ed47d609629cf381e96a9f836d0b46fc..88b2b4cbaefca293bfc851c60963904b3273579e 100644 (file)
@@ -285,6 +285,7 @@ extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len);
 extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, int filename_len);
 
 ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
+ZEND_API void zend_throw_error(zend_class_entry *exception_ce, int type, const char *format, ...);
 ZEND_API void zend_type_error(const char *format, ...);
 ZEND_API void zend_internal_type_error(zend_bool throw_exception, const char *format, ...);
 
index 083160fdf2971c786c4f54faacf54087a8150d58..8229067a9c5add3bf321195d399d497b976789a4 100644 (file)
@@ -245,7 +245,7 @@ ZEND_API void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, cha
                zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be a valid callback, %s",
                        class_name, space, get_active_function_name(), num, error);
        } else {
-               zend_error(severity, "%s%s%s() expects parameter %d to be a valid callback, %s",
+               zend_throw_error(zend_ce_error, severity, "%s%s%s() expects parameter %d to be a valid callback, %s",
                        class_name, space, get_active_function_name(), num, error);
        }
        efree(error);
@@ -710,7 +710,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
                                        break;
                                } else {
                                        if (is_callable_error) {
-                                               *severity = E_EXCEPTION | E_ERROR;
+                                               *severity = E_EXCEPTION;
                                                zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error);
                                                efree(is_callable_error);
                                                return "";
@@ -1273,11 +1273,11 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type
 {
        if (UNEXPECTED(class_type->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) {
                if (class_type->ce_flags & ZEND_ACC_INTERFACE) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot instantiate interface %s", ZSTR_VAL(class_type->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot instantiate interface %s", ZSTR_VAL(class_type->name));
                } else if (class_type->ce_flags & ZEND_ACC_TRAIT) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot instantiate trait %s", ZSTR_VAL(class_type->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot instantiate trait %s", ZSTR_VAL(class_type->name));
                } else {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot instantiate abstract class %s", ZSTR_VAL(class_type->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot instantiate abstract class %s", ZSTR_VAL(class_type->name));
                }
                ZVAL_NULL(arg);
                Z_OBJ_P(arg) = NULL;
@@ -3104,7 +3104,7 @@ get_function_via_handler:
                                        zend_spprintf(error, 0, "cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name));
                                        retval = 0;
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name));
                                        return 0;
                                }
                        } else if (!fcc->object && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) {
@@ -3115,7 +3115,7 @@ get_function_via_handler:
                                        verb = "should not";
                                } else {
                                        /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
-                                       severity = E_EXCEPTION | E_ERROR;
+                                       severity = E_EXCEPTION;
                                        verb = "cannot";
                                }
                                if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0) {
@@ -3127,7 +3127,7 @@ get_function_via_handler:
                                                retval = 0;
                                        }
                                } else if (retval) {
-                                       zend_error(severity, "Non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb);
+                                       zend_throw_error(zend_ce_error, severity, "Non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb);
                                }
                        }
                        if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) {
index 94168d113fd38176bf56de2ff6650e8e67ccf52b..fe9f2f0de3bc2ed1c4a83eea7ca6957f3342677c 100644 (file)
@@ -203,7 +203,7 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
                        zend_hash_index_update(Z_ARRVAL_P(result), zend_dval_to_lval(Z_DVAL_P(offset)), expr);
                        break;
                default:
-                       zend_error(E_EXCEPTION | E_ERROR, "Illegal offset type");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Illegal offset type");
                        return FAILURE;
        }
        return SUCCESS;
@@ -405,7 +405,7 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *sc
                        }
                        break;
                default:
-                       zend_error(E_EXCEPTION | E_ERROR, "Unsupported constant expression");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Unsupported constant expression");
                        ret = FAILURE;
        }
        return ret;
index 7117968c378cf2cc93bd0ac14d6c1bbe4bb36b37..51702e9223c4b7e30340b68f7d802d03171ccef7 100644 (file)
@@ -32,7 +32,7 @@
 #define ZEND_CLOSURE_PRINT_NAME "Closure object"
 
 #define ZEND_CLOSURE_PROPERTY_ERROR() \
-       zend_error(E_EXCEPTION | E_ERROR, "Closure object cannot have properties")
+       zend_throw_error(zend_ce_error, E_EXCEPTION, "Closure object cannot have properties")
 
 typedef struct _zend_closure {
        zend_object       std;
@@ -53,7 +53,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
        arguments = emalloc(sizeof(zval) * ZEND_NUM_ARGS());
        if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) {
                efree(arguments);
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot get arguments for calling closure");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot get arguments for calling closure");
                RETVAL_FALSE;
        } else if (call_user_function_ex(CG(function_table), NULL, getThis(), return_value, ZEND_NUM_ARGS(), arguments, 1, NULL) == FAILURE) {
                RETVAL_FALSE;
@@ -207,7 +207,7 @@ ZEND_METHOD(Closure, bind)
 
 static zend_function *zend_closure_get_constructor(zend_object *object) /* {{{ */
 {
-       zend_error(E_EXCEPTION | E_ERROR, "Instantiation of 'Closure' is not allowed");
+       zend_throw_error(zend_ce_error, E_EXCEPTION, "Instantiation of 'Closure' is not allowed");
        return NULL;
 }
 /* }}} */
@@ -450,7 +450,7 @@ static HashTable *zend_closure_get_gc(zval *obj, zval **table, int *n) /* {{{ */
    Private constructor preventing instantiation */
 ZEND_METHOD(Closure, __construct)
 {
-       zend_error(E_EXCEPTION | E_ERROR, "Instantiation of 'Closure' is not allowed");
+       zend_throw_error(zend_ce_error, E_EXCEPTION, "Instantiation of 'Closure' is not allowed");
 }
 /* }}} */
 
index cde1d7aafbe4403eb17f343043b1026d146e58e9..ec92bfd90c053be94ff04a0417411f9f4c18714b 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "zend.h"
 #include "zend_constants.h"
+#include "zend_exceptions.h"
 #include "zend_execute.h"
 #include "zend_variables.h"
 #include "zend_operators.h"
@@ -332,17 +333,17 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
                if (class_name_len == sizeof("self")-1 &&
                    !memcmp(lcname, "self", sizeof("self")-1)) {
                        if (UNEXPECTED(!scope)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot access self:: when no class scope is active");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access self:: when no class scope is active");
                                return NULL;
                        }
                        ce = scope;
                } else if (class_name_len == sizeof("parent")-1 &&
                           !memcmp(lcname, "parent", sizeof("parent")-1)) {
                        if (UNEXPECTED(!scope)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot access parent:: when no class scope is active");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access parent:: when no class scope is active");
                                return NULL;
                        } else if (UNEXPECTED(!scope->parent)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot access parent:: when current class scope has no parent");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access parent:: when current class scope has no parent");
                                return NULL;
                        } else {
                                ce = scope->parent;
@@ -351,7 +352,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
                           !memcmp(lcname, "static", sizeof("static")-1)) {
                        ce = zend_get_called_scope(EG(current_execute_data));
                        if (UNEXPECTED(!ce)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot access static:: when no class scope is active");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access static:: when no class scope is active");
                                return NULL;
                        }
                } else {
@@ -362,7 +363,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
                        ret_constant = zend_hash_find(&ce->constants_table, constant_name);
                        if (ret_constant == NULL) {
                                if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Undefined class constant '%s::%s'", ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined class constant '%s::%s'", ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
                                        zend_string_release(class_name);
                                        zend_string_free(constant_name);
                                        return NULL;
index 9a1b79184ad1ee8f13ce025f1f59dbc73dfa821b..0251d17e312b820a63b444a93ef9c3c07eb6aef6 100644 (file)
@@ -261,7 +261,7 @@ ZEND_METHOD(exception, __construct)
                } else {
                        ce = base_ce;
                }
-               zend_error(E_EXCEPTION | E_ERROR, "Wrong parameters for %s([string $message [, long $code [, Throwable $previous = NULL]]])", ZSTR_VAL(ce->name));
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Wrong parameters for %s([string $message [, long $code [, Throwable $previous = NULL]]])", ZSTR_VAL(ce->name));
                return;
        }
 
@@ -297,7 +297,7 @@ ZEND_METHOD(error_exception, __construct)
                } else {
                        ce = zend_ce_error_exception;
                }
-               zend_error(E_EXCEPTION | E_ERROR, "Wrong parameters for %s([string $message [, long $code, [ long $severity, [ string $filename, [ long $lineno  [, Throwable $previous = NULL]]]]]])", ZSTR_VAL(ce->name));
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Wrong parameters for %s([string $message [, long $code, [ long $severity, [ string $filename, [ long $lineno  [, Throwable $previous = NULL]]]]]])", ZSTR_VAL(ce->name));
                return;
        }
 
@@ -1033,7 +1033,7 @@ ZEND_API void zend_throw_exception_object(zval *exception) /* {{{ */
        exception_ce = Z_OBJCE_P(exception);
 
        if (!exception_ce || !instanceof_function(exception_ce, zend_ce_throwable)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot throw objects that do not implement Throwable");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot throw objects that do not implement Throwable");
                return;
        }
        zend_throw_exception_internal(exception);
index 4c60eb5ae186c466173621a8ce11f37e11110a4a..1e6c21371aacf7930d1af3de8b0a9c511555a277 100644 (file)
@@ -1201,7 +1201,7 @@ static zend_never_inline void zend_assign_to_object_dim(zval *retval, zval *obje
 
        /* Note:  property_name in this case is really the array index! */
        if (!Z_OBJ_HT_P(object)->write_dimension) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                FREE_OP(free_value);
                return;
        }
@@ -1681,7 +1681,7 @@ convert_to_array:
                }
 
                if (dim == NULL) {
-                       zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "[] operator not supported for strings");
                        ZVAL_NULL(result);
                } else {
                        zend_check_string_offset(dim, type);
@@ -1689,7 +1689,7 @@ convert_to_array:
                }
        } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                if (!Z_OBJ_HT_P(container)->read_dimension) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        retval = &EG(error_zval);
                } else {
                        retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result);
@@ -1830,7 +1830,7 @@ try_string_offset:
                }
        } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                if (!Z_OBJ_HT_P(container)->read_dimension) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        ZVAL_NULL(result);
                } else {
                        retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result);
@@ -1922,7 +1922,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
                                        ZVAL_INDIRECT(result, ptr);
                                }
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot access undefined property for object with overloaded property access");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access undefined property for object with overloaded property access");
                                ZVAL_INDIRECT(result, &EG(error_zval));
                        }
                } else {
index bd432deaa48ea937cf25eaf9a250e9dc0ae42076..e362ffeeb8a2ef032c3a6160f8e94a6f27dfa23f 100644 (file)
@@ -534,7 +534,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
        char *colon;
 
        if (IS_CONSTANT_VISITED(p)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot declare self-referencing constant '%s'", Z_STRVAL_P(p));
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot declare self-referencing constant '%s'", Z_STRVAL_P(p));
                return FAILURE;
        } else if (Z_TYPE_P(p) == IS_CONSTANT) {
                int refcount;
@@ -559,7 +559,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
                                RESET_CONSTANT_VISITED(p);
                                return FAILURE;
                        } else if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined class constant '%s'", Z_STRVAL_P(p));
                                RESET_CONSTANT_VISITED(p);
                                return FAILURE;
                        } else {
@@ -586,9 +586,9 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
                                }
                                if ((Z_CONST_FLAGS_P(p) & IS_CONSTANT_UNQUALIFIED) == 0) {
                                        if (ZSTR_VAL(save)[0] == '\\') {
-                                               zend_error(E_EXCEPTION | E_ERROR, "Undefined constant '%s'", ZSTR_VAL(save) + 1);
+                                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined constant '%s'", ZSTR_VAL(save) + 1);
                                        } else {
-                                               zend_error(E_EXCEPTION | E_ERROR, "Undefined constant '%s'", ZSTR_VAL(save));
+                                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined constant '%s'", ZSTR_VAL(save));
                                        }
                                        if (inline_change) {
                                                zend_string_release(save);
@@ -767,7 +767,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
 
        if (func->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) {
                if (func->common.fn_flags & ZEND_ACC_ABSTRACT) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call abstract method %s::%s()", ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
                        return FAILURE;
                }
                if (func->common.fn_flags & ZEND_ACC_DEPRECATED) {
@@ -889,7 +889,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
                        fci->object->handlers->call_method(func->common.function_name, fci->object, call, fci->retval);
                        EG(current_execute_data) = call->prev_execute_data;
                } else {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call overloaded function for non-object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call overloaded function for non-object");
                }
 
                zend_vm_stack_free_args(call);
@@ -1315,30 +1315,26 @@ check_fetch_type:
        switch (fetch_sub_type) {
                case ZEND_FETCH_CLASS_SELF:
                        if (UNEXPECTED(!EG(scope))) {
-                               int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ?
-                                               (E_EXCEPTION | E_ERROR) : E_ERROR;
-                               zend_error(error_type, "Cannot access self:: when no class scope is active");
+                               int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ? E_EXCEPTION : E_ERROR;
+                               zend_throw_error(zend_ce_error, error_type, "Cannot access self:: when no class scope is active");
                        }
                        return EG(scope);
                case ZEND_FETCH_CLASS_PARENT:
                        if (UNEXPECTED(!EG(scope))) {
-                               int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ?
-                                               (E_EXCEPTION | E_ERROR) : E_ERROR;
-                               zend_error(error_type, "Cannot access parent:: when no class scope is active");
+                               int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ? E_EXCEPTION : E_ERROR;
+                               zend_throw_error(zend_ce_error, error_type, "Cannot access parent:: when no class scope is active");
                                return NULL;
                        }
                        if (UNEXPECTED(!EG(scope)->parent)) {
-                               int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ?
-                                               (E_EXCEPTION | E_ERROR) : E_ERROR;
-                               zend_error(error_type, "Cannot access parent:: when current class scope has no parent");
+                               int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ? E_EXCEPTION : E_ERROR;
+                               zend_throw_error(zend_ce_error, error_type, "Cannot access parent:: when current class scope has no parent");
                        }
                        return EG(scope)->parent;
                case ZEND_FETCH_CLASS_STATIC:
                        ce = zend_get_called_scope(EG(current_execute_data));
                        if (UNEXPECTED(!ce)) {
-                               int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ?
-                                               (E_EXCEPTION | E_ERROR) : E_ERROR;
-                               zend_error(error_type, "Cannot access static:: when no class scope is active");
+                               int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ? E_EXCEPTION : E_ERROR;
+                               zend_throw_error(zend_ce_error, error_type, "Cannot access static:: when no class scope is active");
                                return NULL;
                        }
                        return ce;
@@ -1355,14 +1351,13 @@ check_fetch_type:
                return zend_lookup_class_ex(class_name, NULL, 0);
        } else if ((ce = zend_lookup_class_ex(class_name, NULL, 1)) == NULL) {
                if (!(fetch_type & ZEND_FETCH_CLASS_SILENT) && !EG(exception)) {
-                       int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ?
-                                               (E_EXCEPTION | E_ERROR) : E_ERROR;
+                       int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ? E_EXCEPTION : E_ERROR;
                        if (fetch_sub_type == ZEND_FETCH_CLASS_INTERFACE) {
-                               zend_error(error_type, "Interface '%s' not found", ZSTR_VAL(class_name));
+                               zend_throw_error(zend_ce_error, error_type, "Interface '%s' not found", ZSTR_VAL(class_name));
                        } else if (fetch_sub_type == ZEND_FETCH_CLASS_TRAIT) {
-                               zend_error(error_type, "Trait '%s' not found", ZSTR_VAL(class_name));
+                               zend_throw_error(zend_ce_error, error_type, "Trait '%s' not found", ZSTR_VAL(class_name));
                        } else {
-                               zend_error(error_type, "Class '%s' not found", ZSTR_VAL(class_name));
+                               zend_throw_error(zend_ce_error, error_type, "Class '%s' not found", ZSTR_VAL(class_name));
                        }
                }
                return NULL;
@@ -1379,14 +1374,13 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval *
                return zend_lookup_class_ex(class_name, key, 0);
        } else if ((ce = zend_lookup_class_ex(class_name, key, 1)) == NULL) {
                if ((fetch_type & ZEND_FETCH_CLASS_SILENT) == 0 && !EG(exception)) {
-                       int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ?
-                                                       (E_EXCEPTION | E_ERROR) : E_ERROR;
+                       int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ? E_EXCEPTION : E_ERROR;
                        if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_INTERFACE) {
-                               zend_error(error_type, "Interface '%s' not found", ZSTR_VAL(class_name));
+                               zend_throw_error(zend_ce_error, error_type, "Interface '%s' not found", ZSTR_VAL(class_name));
                        } else if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_TRAIT) {
-                               zend_error(error_type, "Trait '%s' not found", ZSTR_VAL(class_name));
+                               zend_throw_error(zend_ce_error, error_type, "Trait '%s' not found", ZSTR_VAL(class_name));
                        } else {
-                               zend_error(error_type, "Class '%s' not found", ZSTR_VAL(class_name));
+                               zend_throw_error(zend_ce_error, error_type, "Class '%s' not found", ZSTR_VAL(class_name));
                        }
                }
                return NULL;
index 66692db905144ffbfb6c3054254ddf93b412b5fe..4be9da3bef5713d78346488b64f628feebd859e0 100644 (file)
@@ -265,7 +265,7 @@ ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array
 
 static zend_function *zend_generator_get_constructor(zend_object *object) /* {{{ */
 {
-       zend_error(E_EXCEPTION | E_ERROR, "The \"Generator\" class is reserved for internal use and cannot be manually instantiated");
+       zend_throw_error(zend_ce_error, E_EXCEPTION, "The \"Generator\" class is reserved for internal use and cannot be manually instantiated");
 
        return NULL;
 }
@@ -637,7 +637,7 @@ ZEND_API void zend_generator_resume(zend_generator *orig_generator) /* {{{ */
 
 try_again:
        if (generator->flags & ZEND_GENERATOR_CURRENTLY_RUNNING) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot resume an already running generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot resume an already running generator");
                return;
        }
 
index 351b4da2ceb727fdb3b834f9ed1895bd72b840e7..594b84c913e9cb66ef22eb7d4e4512fa84c36b92 100644 (file)
@@ -262,7 +262,7 @@ static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zva
        zend_user_iterator *iterator;
 
        if (by_ref) {
-               zend_error(E_EXCEPTION | E_ERROR, "An iterator cannot be used with foreach by reference");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "An iterator cannot be used with foreach by reference");
                return NULL;
        }
 
index 144adc25bb2b1000298fc1d2a18ec11942db17ca..3faff8c1522ed7e1b4ac5d32aa3158b71c5ec280 100644 (file)
@@ -27,6 +27,7 @@
 #include "zend_objects_API.h"
 #include "zend_object_handlers.h"
 #include "zend_interfaces.h"
+#include "zend_exceptions.h"
 #include "zend_closures.h"
 #include "zend_compile.h"
 #include "zend_hash.h"
@@ -303,9 +304,9 @@ static zend_always_inline uint32_t zend_get_property_offset(zend_class_entry *ce
        if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0')) {
                if (!silent) {
                        if (ZSTR_LEN(member) == 0) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot access empty property");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access empty property");
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot access property started with '\\0'");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access property started with '\\0'");
                        }
                }
                return ZEND_WRONG_PROPERTY_OFFSET;
@@ -359,7 +360,7 @@ exit_dynamic:
        } else if (UNEXPECTED(property_info == ZEND_WRONG_PROPERTY_INFO)) {
                /* Information was available, but we were denied access.  Error out. */
                if (!silent) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ZSTR_VAL(ce->name), ZSTR_VAL(member));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ZSTR_VAL(ce->name), ZSTR_VAL(member));
                }
                return ZEND_WRONG_PROPERTY_OFFSET;
        }
@@ -381,9 +382,9 @@ ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_s
        if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0')) {
                if (!silent) {
                        if (ZSTR_LEN(member) == 0) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot access empty property");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access empty property");
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot access property started with '\\0'");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access property started with '\\0'");
                        }
                }
                return ZEND_WRONG_PROPERTY_INFO;
@@ -430,7 +431,7 @@ exit_dynamic:
        } else if (UNEXPECTED(property_info == ZEND_WRONG_PROPERTY_INFO)) {
                /* Information was available, but we were denied access.  Error out. */
                if (!silent) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ZSTR_VAL(ce->name), ZSTR_VAL(member));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ZSTR_VAL(ce->name), ZSTR_VAL(member));
                }
                return ZEND_WRONG_PROPERTY_INFO;
        }
@@ -577,11 +578,11 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
                } else {
                        if (Z_STRVAL_P(member)[0] == '\0') {
                                if (Z_STRLEN_P(member) == 0) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot access empty property");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access empty property");
                                        retval = &EG(uninitialized_zval);
                                        goto exit;
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot access property started with '\\0'");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access property started with '\\0'");
                                        retval = &EG(uninitialized_zval);
                                        goto exit;
                                }
@@ -663,10 +664,10 @@ found:
                } else {
                        if (Z_STRVAL_P(member)[0] == '\0') {
                                if (Z_STRLEN_P(member) == 0) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot access empty property");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access empty property");
                                        goto exit;
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot access property started with '\\0'");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access property started with '\\0'");
                                        goto exit;
                                }
                        }
@@ -720,13 +721,13 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /*
 
                if (UNEXPECTED(Z_TYPE_P(rv) == IS_UNDEF)) {
                        if (UNEXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Undefined offset for object of type %s used as array", ZSTR_VAL(ce->name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined offset for object of type %s used as array", ZSTR_VAL(ce->name));
                        }
                        return NULL;
                }
                return rv;
        } else {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
                return NULL;
        }
 }
@@ -747,7 +748,7 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value) /*
                zend_call_method_with_2_params(object, ce, NULL, "offsetset", NULL, offset, value);
                zval_ptr_dtor(offset);
        } else {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
        }
 }
 /* }}} */
@@ -776,7 +777,7 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty) /
                }
                zval_ptr_dtor(offset);
        } else {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
                return 0;
        }
        return result;
@@ -913,10 +914,10 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo
                } else {
                        if (Z_STRVAL_P(member)[0] == '\0') {
                                if (Z_STRLEN_P(member) == 0) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot access empty property");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access empty property");
                                        goto exit;
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot access property started with '\\0'");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access property started with '\\0'");
                                        goto exit;
                                }
                        }
@@ -939,7 +940,7 @@ static void zend_std_unset_dimension(zval *object, zval *offset) /* {{{ */
                zend_call_method_with_1_params(object, ce, NULL, "offsetunset", NULL, offset);
                zval_ptr_dtor(offset);
        } else {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
        }
 }
 /* }}} */
@@ -1114,7 +1115,7 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
                        if (zobj->ce->__call) {
                                fbc = zend_get_user_call_function(zobj->ce, method_name);
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(method_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(method_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
                                fbc = NULL;
                        }
                }
@@ -1141,7 +1142,7 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
                                if (zobj->ce->__call) {
                                        fbc = zend_get_user_call_function(zobj->ce, method_name);
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(method_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(method_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
                                        fbc = NULL;
                                }
                        }
@@ -1234,7 +1235,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
                        if (ce->__callstatic) {
                                fbc = zend_get_user_callstatic_function(ce, function_name);
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(function_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(function_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
                                fbc = NULL;
                        }
                }
@@ -1245,7 +1246,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
                        if (ce->__callstatic) {
                                fbc = zend_get_user_callstatic_function(ce, function_name);
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(function_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(function_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
                                fbc = NULL;
                        }
                }
@@ -1270,7 +1271,7 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p
 
        if (UNEXPECTED(!zend_verify_property_access(property_info, ce))) {
                if (!silent) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ZSTR_VAL(ce->name), ZSTR_VAL(property_name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ZSTR_VAL(ce->name), ZSTR_VAL(property_name));
                }
                return NULL;
        }
@@ -1290,7 +1291,7 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p
        if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
 undeclared_property:
                if (!silent) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(property_name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(property_name));
                }
                ret = NULL;
        }
@@ -1301,7 +1302,7 @@ undeclared_property:
 
 ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name) /* {{{ */
 {
-       zend_error(E_EXCEPTION | E_ERROR, "Attempt to unset static property %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(property_name));
+       zend_throw_error(zend_ce_error, E_EXCEPTION, "Attempt to unset static property %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(property_name));
        return 0;
 }
 /* }}} */
@@ -1318,10 +1319,10 @@ ZEND_API union _zend_function *zend_std_get_constructor(zend_object *zobj) /* {{
                         */
                        if (UNEXPECTED(constructor->common.scope != EG(scope))) {
                                if (EG(scope)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::%s() from context '%s'", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name), ZSTR_VAL(EG(scope)->name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to private %s::%s() from context '%s'", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name), ZSTR_VAL(EG(scope)->name));
                                        constructor = NULL;
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::%s() from invalid context", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to private %s::%s() from invalid context", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name));
                                        constructor = NULL;
                                }
                        }
@@ -1332,10 +1333,10 @@ ZEND_API union _zend_function *zend_std_get_constructor(zend_object *zobj) /* {{
                         */
                        if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(constructor), EG(scope)))) {
                                if (EG(scope)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::%s() from context '%s'", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name), ZSTR_VAL(EG(scope)->name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to protected %s::%s() from context '%s'", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name), ZSTR_VAL(EG(scope)->name));
                                        constructor = NULL;
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::%s() from invalid context", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to protected %s::%s() from invalid context", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name));
                                        constructor = NULL;
                                }
                        }
index 6dc1a2d07600910359253f03b895c87b7d57edd6..cc26aa98d94e396782b711bc80778e222df61d20 100644 (file)
@@ -93,7 +93,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object)
                                if (object->ce != EG(scope)) {
                                        zend_class_entry *ce = object->ce;
 
-                                       zend_error(EG(current_execute_data) ? E_EXCEPTION | E_ERROR : E_WARNING,
+                                       zend_throw_error(zend_ce_error, EG(current_execute_data) ? E_EXCEPTION : E_WARNING,
                                                "Call to private %s::__destruct() from context '%s'%s",
                                                ZSTR_VAL(ce->name),
                                                EG(scope) ? ZSTR_VAL(EG(scope)->name) : "",
@@ -106,7 +106,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object)
                                if (!zend_check_protected(zend_get_function_root_class(destructor), EG(scope))) {
                                        zend_class_entry *ce = object->ce;
 
-                                       zend_error(EG(current_execute_data) ? E_EXCEPTION | E_ERROR : E_WARNING,
+                                       zend_throw_error(zend_ce_error, EG(current_execute_data) ? E_EXCEPTION : E_WARNING,
                                                "Call to protected %s::__destruct() from context '%s'%s",
                                                ZSTR_VAL(ce->name),
                                                EG(scope) ? ZSTR_VAL(EG(scope)->name) : "",
index 5e7a2911a1127c6a439eebf96ab3def815af63ad..579ca0c393f59f7b43a530149bebe95f29045531 100644 (file)
@@ -907,7 +907,7 @@ ZEND_API int ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* {
                                        zendi_convert_scalar_to_number(op2, op2_copy, result);
                                        converted = 1;
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Unsupported operand types");
                                        return FAILURE; /* unknown datatype */
                                }
                }
@@ -960,7 +960,7 @@ ZEND_API int ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* {
                                        zendi_convert_scalar_to_number(op2, op2_copy, result);
                                        converted = 1;
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Unsupported operand types");
                                        return FAILURE; /* unknown datatype */
                                }
                }
@@ -1007,7 +1007,7 @@ ZEND_API int ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* {
                                        zendi_convert_scalar_to_number(op2, op2_copy, result);
                                        converted = 1;
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Unsupported operand types");
                                        return FAILURE; /* unknown datatype */
                                }
                }
@@ -1095,7 +1095,7 @@ ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {
                                        }
                                        converted = 1;
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Unsupported operand types");
                                        return FAILURE;
                                }
                }
@@ -1144,7 +1144,7 @@ ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {
                                        zendi_convert_scalar_to_number(op2, op2_copy, result);
                                        converted = 1;
                                } else {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Unsupported operand types");
                                        return FAILURE; /* unknown datatype */
                                }
                }
@@ -1294,7 +1294,7 @@ try_again:
                default:
                        ZEND_TRY_UNARY_OBJECT_OPERATION(ZEND_BW_NOT);
 
-                       zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Unsupported operand types");
                        return FAILURE;
        }
 }
@@ -1611,7 +1611,7 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /
                zend_string *result_str;
 
                if (UNEXPECTED(op1_len > SIZE_MAX - op2_len)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "String size overflow");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "String size overflow");
                        ZVAL_FALSE(result);
                        return FAILURE;
                }
index 294a9ba9c79c0b8f4e54c86304676e9d7e45b6a1..6fac54ab8359583facac27b6e9546eb3ceb79056 100644 (file)
@@ -721,7 +721,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMPVAR|
        object = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
@@ -730,7 +730,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMPVAR|
        property = GET_OP2_ZVAL_PTR(BP_VAR_R);
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                FREE_OP2();
                HANDLE_EXCEPTION();
@@ -785,13 +785,13 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_dim_helper, VAR|UNUSED|CV, CONST|TMPVAR|
        SAVE_OPLINE();
        container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
        if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
@@ -817,7 +817,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_dim_helper, VAR|UNUSED|CV, CONST|TMPVAR|
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
                        FREE_OP2();
                        FREE_OP(free_op_data1);
                        FREE_OP1_VAR_PTR();
@@ -860,7 +860,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|CV, CONST|TMPVAR|CV, binary_
        var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
                FREE_OP2();
                HANDLE_EXCEPTION();
        }
@@ -1118,7 +1118,7 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMPVAR|C
        object = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
@@ -1126,7 +1126,7 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMPVAR|C
        property = GET_OP2_ZVAL_PTR(BP_VAR_R);
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                FREE_OP2();
                HANDLE_EXCEPTION();
        }
@@ -1200,7 +1200,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMPVAR|
        object = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
@@ -1208,7 +1208,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMPVAR|
        property = GET_OP2_ZVAL_PTR(BP_VAR_R);
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                FREE_OP2();
                HANDLE_EXCEPTION();
        }
@@ -1276,7 +1276,7 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY)
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -1323,7 +1323,7 @@ ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY)
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -1370,7 +1370,7 @@ ZEND_VM_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY)
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -1410,7 +1410,7 @@ ZEND_VM_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY)
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -1506,7 +1506,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED|CONST|V
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
                                        FREE_OP1();
                                        HANDLE_EXCEPTION();
                                }
@@ -1533,7 +1533,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED|CONST|V
                                
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
                                        FREE_OP1();
                                        HANDLE_EXCEPTION();
                                }
@@ -1684,7 +1684,7 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMPVAR|UNUSED|CV)
        container = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE);
@@ -1707,7 +1707,7 @@ ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMPVAR|UNUSED|CV)
        container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE);
@@ -1745,14 +1745,14 @@ ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, CONST|TMP|VAR|CV, CONST|TMPVAR|UNUS
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
                        FREE_UNFETCHED_OP2();
                        FREE_UNFETCHED_OP1();
                        HANDLE_EXCEPTION();
         }
                container = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
                if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                        FREE_UNFETCHED_OP2();
                        HANDLE_EXCEPTION();
                }
@@ -1764,7 +1764,7 @@ ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, CONST|TMP|VAR|CV, CONST|TMPVAR|UNUS
                FREE_OP1_VAR_PTR();
        } else {
                if (OP2_TYPE == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
                        FREE_UNFETCHED_OP2();
                        FREE_UNFETCHED_OP1();
                        HANDLE_EXCEPTION();
@@ -1788,7 +1788,7 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMPVAR|CV)
        container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_UNSET);
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
@@ -1814,7 +1814,7 @@ ZEND_VM_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMP|VAR|UNUSED|CV, CONST|TMPVAR|CV)
        container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
@@ -1888,12 +1888,12 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMPVAR|CV)
 
        container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_OP2();
                HANDLE_EXCEPTION();
        }
        if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_OP2();
                HANDLE_EXCEPTION();
        }
@@ -1920,12 +1920,12 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|CV, CONST|TMPVAR|CV)
        container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_OP2();
                HANDLE_EXCEPTION();
        }
        if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_OP2();
                HANDLE_EXCEPTION();
        }
@@ -1951,7 +1951,7 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR|CV)
        container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_IS);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
@@ -2028,18 +2028,18 @@ ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, CONST|TMP|VAR|UNUSED|CV, CONST|TMPV
                container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
 
                if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                        FREE_OP2();
                        HANDLE_EXCEPTION();
                }
                if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
                        FREE_OP2();
                        FREE_OP1_VAR_PTR();
                        HANDLE_EXCEPTION();
                }
                if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                        FREE_OP2();
                        HANDLE_EXCEPTION();
                }
@@ -2066,7 +2066,7 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMPVAR|CV)
        container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
@@ -2074,7 +2074,7 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMPVAR|CV)
        property = GET_OP2_ZVAL_PTR(BP_VAR_R);
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_OP2();
                HANDLE_EXCEPTION();
        }
@@ -2144,7 +2144,7 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, CONST|TMPVAR|CV)
        object = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
@@ -2152,7 +2152,7 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, CONST|TMPVAR|CV)
        property_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_OP2();
                HANDLE_EXCEPTION();
        }
@@ -2179,7 +2179,7 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMPVAR|UNUSED|CV)
        object_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
@@ -2228,7 +2228,7 @@ ZEND_VM_C_LABEL(try_assign_dim_array):
                } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
                        if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) {
                                if (OP2_TYPE == IS_UNUSED) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "[] operator not supported for strings");
                                        FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                                        FREE_OP1_VAR_PTR();
                                        HANDLE_EXCEPTION();
@@ -2313,7 +2313,7 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
        value_ptr = GET_OP2_ZVAL_PTR_PTR(BP_VAR_W);
 
        if (OP2_TYPE == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets nor overloaded objects");
                FREE_UNFETCHED_OP1();
                HANDLE_EXCEPTION();
        }
@@ -2334,14 +2334,14 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
 
        variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
        if (OP1_TYPE == IS_VAR && UNEXPECTED(variable_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets nor overloaded objects");
                FREE_OP2_VAR_PTR();
                HANDLE_EXCEPTION();
        }
        if (OP1_TYPE == IS_VAR &&
            UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT) &&
            UNEXPECTED(!Z_ISREF_P(variable_ptr))) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot assign by reference to overloaded object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot assign by reference to overloaded object");
                FREE_OP2_VAR_PTR();
                FREE_OP1_VAR_PTR();
                HANDLE_EXCEPTION();
@@ -2916,7 +2916,7 @@ ZEND_VM_C_LABEL(try_class_name):
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Class name must be a valid object or a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class name must be a valid object or a string");
                }
 
                FREE_OP2();
@@ -2956,7 +2956,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
                        FREE_OP2();
                        FREE_UNFETCHED_OP1();
                        HANDLE_EXCEPTION();
@@ -2966,7 +2966,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR
        object = GET_OP1_OBJ_ZVAL_PTR_UNDEF(BP_VAR_R);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_OP2();
                HANDLE_EXCEPTION();
        }
@@ -2986,7 +2986,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
                                FREE_OP2();
                                FREE_OP1();
                                HANDLE_EXCEPTION();
@@ -3002,7 +3002,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
                        FREE_OP2();
                        FREE_OP1();
                        HANDLE_EXCEPTION();
@@ -3012,7 +3012,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((OP2_TYPE == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
                        FREE_OP2();
                        FREE_OP1();
@@ -3068,7 +3068,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSE
                                HANDLE_EXCEPTION();
                        }
                        if (UNEXPECTED(ce == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                HANDLE_EXCEPTION();
                        }
                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -3097,7 +3097,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSE
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
                                FREE_OP2();
                                HANDLE_EXCEPTION();
                        }
@@ -3110,7 +3110,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSE
                }
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
                        }
                        FREE_OP2();
                        HANDLE_EXCEPTION();
@@ -3129,11 +3129,11 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSE
                }
        } else {
                if (UNEXPECTED(ce->constructor == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call constructor");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call constructor");
                        HANDLE_EXCEPTION();
                }
                if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
                        HANDLE_EXCEPTION();
                }
                fbc = ce->constructor;
@@ -3154,8 +3154,9 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSE
                        } else {
                                /* An internal function assumes $this is present and won't check that.
                                 * So PHP would crash by allowing the call. */
-                               zend_error(
-                                       E_EXCEPTION | E_ERROR,
+                               zend_throw_error(
+                                       zend_ce_error,
+                                       E_EXCEPTION,
                                        "Non-static method %s::%s() cannot be called statically",
                                        ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                HANDLE_EXCEPTION();
@@ -3193,7 +3194,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST)
                function_name = (zval*)(EX_CONSTANT(opline->op2)+1);
                if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
                        SAVE_OPLINE();
-                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined function %s()", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                        HANDLE_EXCEPTION();
                } else {
                        fbc = Z_FUNC_P(func);
@@ -3254,7 +3255,7 @@ ZEND_VM_C_LABEL(try_function_name):
                        }
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname));
                                }
                                zend_string_release(lcname);
                                zend_string_release(mname);
@@ -3271,8 +3272,9 @@ ZEND_VM_C_LABEL(try_function_name):
                                                "Non-static method %s::%s() should not be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                } else {
-                                       zend_error(
-                                               E_EXCEPTION | E_ERROR,
+                                       zend_throw_error(
+                                               zend_ce_error,
+                                               E_EXCEPTION,
                                                "Non-static method %s::%s() cannot be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                        FREE_OP2();
@@ -3287,7 +3289,7 @@ ZEND_VM_C_LABEL(try_function_name):
                                lcname = zend_string_tolower(Z_STR_P(function_name));
                        }
                        if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined function %s()", Z_STRVAL_P(function_name));
                                zend_string_release(lcname);
                                FREE_OP2();
                                HANDLE_EXCEPTION();
@@ -3318,21 +3320,21 @@ ZEND_VM_C_LABEL(try_function_name):
                method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
 
                if (!obj || !method) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Array callback has to contain indices 0 and 1");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Array callback has to contain indices 0 and 1");
                        FREE_OP2();
                        HANDLE_EXCEPTION();
                }
 
                ZVAL_DEREF(obj);
                if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
-                       zend_error(E_EXCEPTION | E_ERROR, "First array member is not a valid class name or object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "First array member is not a valid class name or object");
                        FREE_OP2();
                        HANDLE_EXCEPTION();
                }
 
                ZVAL_DEREF(method);
                if (Z_TYPE_P(method) != IS_STRING) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Second array member is not a valid method");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Second array member is not a valid method");
                        FREE_OP2();
                        HANDLE_EXCEPTION();
                }
@@ -3352,7 +3354,7 @@ ZEND_VM_C_LABEL(try_function_name):
                        }
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method));
                                }
                                FREE_OP2();
                                HANDLE_EXCEPTION();
@@ -3363,8 +3365,9 @@ ZEND_VM_C_LABEL(try_function_name):
                                                "Non-static method %s::%s() should not be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                } else {
-                                       zend_error(
-                                               E_EXCEPTION | E_ERROR,
+                                       zend_throw_error(
+                                               zend_ce_error,
+                                               E_EXCEPTION,
                                                "Non-static method %s::%s() cannot be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                        FREE_OP2();
@@ -3378,7 +3381,7 @@ ZEND_VM_C_LABEL(try_function_name):
                        fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL);
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method));
                                }
                                FREE_OP2();
                                HANDLE_EXCEPTION();
@@ -3402,7 +3405,7 @@ ZEND_VM_C_LABEL(try_function_name):
                if (UNEXPECTED(EG(exception) != NULL)) {
                        HANDLE_EXCEPTION();
                }
-               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
                FREE_OP2();
                HANDLE_EXCEPTION();
        }
@@ -3487,7 +3490,7 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
                func_name++;
                if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL)) {
                        SAVE_OPLINE();
-                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined function %s()", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                        HANDLE_EXCEPTION();
                } else {
                        fbc = Z_FUNC_P(func);
@@ -3519,7 +3522,7 @@ ZEND_VM_HANDLER(61, ZEND_INIT_FCALL, ANY, CONST)
                fbc = CACHED_PTR(Z_CACHE_SLOT_P(fname));
        } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(fname))) == NULL)) {
            SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(fname));
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined function %s()", Z_STRVAL_P(fname));
                HANDLE_EXCEPTION();
        } else {
                fbc = Z_FUNC_P(func);
@@ -3722,7 +3725,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
        EX(call) = call->prev_execute_data;
        if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
                if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call abstract method %s::%s()", ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                        HANDLE_EXCEPTION();
                }
                if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
@@ -3847,7 +3850,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
                        object->handlers->call_method(fbc->common.function_name, object, call, EX_VAR(opline->result.var));
                        EG(current_execute_data) = call->prev_execute_data;
                } else {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call overloaded function for non-object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call overloaded function for non-object");
 #if 0
                        //TODO: implement clean exit ???
                        zend_vm_stack_free_args(call);
@@ -4041,7 +4044,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
                retval_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
 
                if (OP1_TYPE == IS_VAR && UNEXPECTED(retval_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot return string offsets by reference");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot return string offsets by reference");
                        HANDLE_EXCEPTION();
                }
 
@@ -4139,7 +4142,7 @@ ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Can only throw objects");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Can only throw objects");
                        FREE_OP1();
                        HANDLE_EXCEPTION();
                }
@@ -4237,7 +4240,7 @@ ZEND_VM_HANDLER(116, ZEND_SEND_VAL_EX, CONST|TMP, ANY)
        } else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
 ZEND_VM_C_LABEL(send_val_by_ref):
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot pass parameter %d by reference", opline->op2.num);
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot pass parameter %d by reference", opline->op2.num);
                FREE_UNFETCHED_OP1();
                arg = ZEND_CALL_VAR(EX(call), opline->result.var);
                ZVAL_UNDEF(arg);
@@ -4342,7 +4345,7 @@ ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY)
        varptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
 
        if (OP1_TYPE == IS_VAR && UNEXPECTED(varptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Only variables can be passed by reference");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Only variables can be passed by reference");
                HANDLE_EXCEPTION();
        }
 
@@ -4451,7 +4454,7 @@ ZEND_VM_C_LABEL(send_again):
 
                ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) {
                        if (name) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot unpack array with string keys");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unpack array with string keys");
                                FREE_OP1();
                                HANDLE_EXCEPTION();
                        }
@@ -4521,7 +4524,7 @@ ZEND_VM_C_LABEL(send_again):
                                        }
 
                                        if (Z_TYPE(key) == IS_STRING) {
-                                               zend_error(E_EXCEPTION | E_ERROR,
+                                               zend_throw_error(zend_ce_error, E_EXCEPTION,
                                                        "Cannot unpack Traversable with string keys");
                                                zend_string_release(Z_STR(key));
                                                ZEND_VM_C_GOTO(unpack_iter_dtor);
@@ -5021,7 +5024,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|CV, ANY)
        obj = GET_OP1_OBJ_ZVAL_PTR_UNDEF(BP_VAR_R);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(obj) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                HANDLE_EXCEPTION();
        }
 
@@ -5040,7 +5043,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|CV, ANY)
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "__clone method called on non-object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "__clone method called on non-object");
                        FREE_OP1();
                        HANDLE_EXCEPTION();
                }
@@ -5051,9 +5054,9 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|CV, ANY)
        clone_call =  Z_OBJ_HT_P(obj)->clone_obj;
        if (UNEXPECTED(clone_call == NULL)) {
                if (ce) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
                } else {
-                       zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Trying to clone an uncloneable object");
                }
                FREE_OP1();
                HANDLE_EXCEPTION();
@@ -5064,7 +5067,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|CV, ANY)
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (UNEXPECTED(ce != EG(scope))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
                                FREE_OP1();
                                HANDLE_EXCEPTION();
                        }
@@ -5072,7 +5075,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|CV, ANY)
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
                                FREE_OP1();
                                HANDLE_EXCEPTION();
                        }
@@ -5116,7 +5119,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
                                CHECK_EXCEPTION();
                                ZEND_VM_NEXT_OPCODE();
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Undefined constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                HANDLE_EXCEPTION();
                        }
                } else {
@@ -5153,7 +5156,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
                                                HANDLE_EXCEPTION();
                                        }
                                        if (UNEXPECTED(ce == NULL)) {
-                                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                                HANDLE_EXCEPTION();
                                        }
                                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -5182,7 +5185,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
                                        CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce, value);
                                }
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined class constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                HANDLE_EXCEPTION();
                        }
                } while (0);
@@ -5210,7 +5213,7 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMPVAR|UNUSE
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
                if (OP1_TYPE == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -5620,7 +5623,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMPVAR|CV, UNUSED|CONST|VAR)
                                        HANDLE_EXCEPTION();
                                }
                                if (UNEXPECTED(ce == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                        if (OP1_TYPE != IS_CONST) {
                                                zend_string_release(Z_STR(tmp));
                                        }
@@ -5657,12 +5660,12 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMPVAR|CV)
        SAVE_OPLINE();
        container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
        if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
@@ -5730,12 +5733,12 @@ ZEND_VM_C_LABEL(num_index_dim):
                }
                if (OP1_TYPE == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                        if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        } else {
                                Z_OBJ_HT_P(container)->unset_dimension(container, offset);
                        }
                } else if (OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                }
        } while (0);
 
@@ -5755,12 +5758,12 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CONST|TMPVAR|CV)
        SAVE_OPLINE();
        container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
        if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
@@ -6560,7 +6563,7 @@ ZEND_VM_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, CONST|TMPVAR|UNUSED|CV, CONST|T
        container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_IS);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
@@ -6697,7 +6700,7 @@ ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, CONST|TMPVAR|UNUSED|CV, CONST|
        container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_IS);
 
        if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP2();
                HANDLE_EXCEPTION();
        }
@@ -7364,7 +7367,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
                FREE_UNFETCHED_OP2();
                FREE_UNFETCHED_OP1();
                HANDLE_EXCEPTION();
@@ -7399,7 +7402,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
                                zval *value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
 
                                if (OP1_TYPE == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
                                        FREE_UNFETCHED_OP2();
                                        HANDLE_EXCEPTION();
                                }
@@ -7530,13 +7533,13 @@ ZEND_VM_HANDLER(142, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
 
                        if (Z_ISUNDEF(new_gen->retval)) {
                                if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
-                                       zend_error(E_ERROR | E_EXCEPTION, "Impossible to yield from the Generator being currently run");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Impossible to yield from the Generator being currently run");
                                        HANDLE_EXCEPTION();
                                } else {
                                        zend_generator_yield_from(generator, new_gen);
                                }
                        } else if (UNEXPECTED(new_gen->execute_data == NULL)) {
-                               zend_error(E_ERROR | E_EXCEPTION, "Generator passed to yield from was aborted without proper return and is unable to continue");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Generator passed to yield from was aborted without proper return and is unable to continue");
                                HANDLE_EXCEPTION();
                        } else {
                                if (RETURN_VALUE_USED(opline)) {
@@ -7550,7 +7553,7 @@ ZEND_VM_HANDLER(142, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
 
                        if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
                                if (!EG(exception)) {
-                                       zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
                                }
                                HANDLE_EXCEPTION();
                        }
@@ -7567,7 +7570,7 @@ ZEND_VM_HANDLER(142, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
                        ZVAL_OBJ(&generator->values, &iter->std);
                }
        } else {
-               zend_error(E_ERROR | E_EXCEPTION, "Can use \"yield from\" only with arrays and Traversables", 0);
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Can use \"yield from\" only with arrays and Traversables", 0);
                HANDLE_EXCEPTION();
        }
 
@@ -7887,7 +7890,7 @@ ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, ANY, ANY)
        fetch_type = opline->extended_value;
 
        if (UNEXPECTED(EG(scope) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use \"%s\" when no class scope is active",
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use \"%s\" when no class scope is active",
                        fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
                        fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
                HANDLE_EXCEPTION();
@@ -7899,7 +7902,7 @@ ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, ANY, ANY)
                        break;
                case ZEND_FETCH_CLASS_PARENT:
                        if (UNEXPECTED(EG(scope)->parent == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR,
+                               zend_throw_error(zend_ce_error, E_EXCEPTION,
                                        "Cannot use \"parent\" when current class scope has no parent");
                                HANDLE_EXCEPTION();
                        }
index 729ad1be6d1cee64674d27d610eeeec7eb39b37a..d11ce033fb4ff271dbb7b093ed4a646a7d4799fc 100644 (file)
@@ -745,7 +745,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPC
        EX(call) = call->prev_execute_data;
        if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
                if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call abstract method %s::%s()", ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                        HANDLE_EXCEPTION();
                }
                if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
@@ -870,7 +870,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPC
                        object->handlers->call_method(fbc->common.function_name, object, call, EX_VAR(opline->result.var));
                        EG(current_execute_data) = call->prev_execute_data;
                } else {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call overloaded function for non-object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call overloaded function for non-object");
 #if 0
                        //TODO: implement clean exit ???
                        zend_vm_stack_free_args(call);
@@ -971,7 +971,7 @@ send_again:
 
                ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) {
                        if (name) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot unpack array with string keys");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unpack array with string keys");
                                FREE_OP(free_op1);
                                HANDLE_EXCEPTION();
                        }
@@ -1041,7 +1041,7 @@ send_again:
                                        }
 
                                        if (Z_TYPE(key) == IS_STRING) {
-                                               zend_error(E_EXCEPTION | E_ERROR,
+                                               zend_throw_error(zend_ce_error, E_EXCEPTION,
                                                        "Cannot unpack Traversable with string keys");
                                                zend_string_release(Z_STR(key));
                                                goto unpack_iter_dtor;
@@ -1676,7 +1676,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_HANDLER(
        fetch_type = opline->extended_value;
 
        if (UNEXPECTED(EG(scope) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use \"%s\" when no class scope is active",
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use \"%s\" when no class scope is active",
                        fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
                        fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
                HANDLE_EXCEPTION();
@@ -1688,7 +1688,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_HANDLER(
                        break;
                case ZEND_FETCH_CLASS_PARENT:
                        if (UNEXPECTED(EG(scope)->parent == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR,
+                               zend_throw_error(zend_ce_error, E_EXCEPTION,
                                        "Cannot use \"parent\" when current class scope has no parent");
                                HANDLE_EXCEPTION();
                        }
@@ -1879,7 +1879,7 @@ try_class_name:
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Class name must be a valid object or a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class name must be a valid object or a string");
                }
 
                CHECK_EXCEPTION();
@@ -1900,7 +1900,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_
                function_name = (zval*)(EX_CONSTANT(opline->op2)+1);
                if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
                        SAVE_OPLINE();
-                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined function %s()", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                        HANDLE_EXCEPTION();
                } else {
                        fbc = Z_FUNC_P(func);
@@ -1961,7 +1961,7 @@ try_function_name:
                        }
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname));
                                }
                                zend_string_release(lcname);
                                zend_string_release(mname);
@@ -1978,8 +1978,9 @@ try_function_name:
                                                "Non-static method %s::%s() should not be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                } else {
-                                       zend_error(
-                                               E_EXCEPTION | E_ERROR,
+                                       zend_throw_error(
+                                               zend_ce_error,
+                                               E_EXCEPTION,
                                                "Non-static method %s::%s() cannot be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
 
@@ -1994,7 +1995,7 @@ try_function_name:
                                lcname = zend_string_tolower(Z_STR_P(function_name));
                        }
                        if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined function %s()", Z_STRVAL_P(function_name));
                                zend_string_release(lcname);
 
                                HANDLE_EXCEPTION();
@@ -2025,21 +2026,21 @@ try_function_name:
                method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
 
                if (!obj || !method) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Array callback has to contain indices 0 and 1");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Array callback has to contain indices 0 and 1");
 
                        HANDLE_EXCEPTION();
                }
 
                ZVAL_DEREF(obj);
                if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
-                       zend_error(E_EXCEPTION | E_ERROR, "First array member is not a valid class name or object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "First array member is not a valid class name or object");
 
                        HANDLE_EXCEPTION();
                }
 
                ZVAL_DEREF(method);
                if (Z_TYPE_P(method) != IS_STRING) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Second array member is not a valid method");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Second array member is not a valid method");
 
                        HANDLE_EXCEPTION();
                }
@@ -2059,7 +2060,7 @@ try_function_name:
                        }
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method));
                                }
 
                                HANDLE_EXCEPTION();
@@ -2070,8 +2071,9 @@ try_function_name:
                                                "Non-static method %s::%s() should not be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                } else {
-                                       zend_error(
-                                               E_EXCEPTION | E_ERROR,
+                                       zend_throw_error(
+                                               zend_ce_error,
+                                               E_EXCEPTION,
                                                "Non-static method %s::%s() cannot be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
 
@@ -2085,7 +2087,7 @@ try_function_name:
                        fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL);
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method));
                                }
 
                                HANDLE_EXCEPTION();
@@ -2109,7 +2111,7 @@ try_function_name:
                if (UNEXPECTED(EG(exception) != NULL)) {
                        HANDLE_EXCEPTION();
                }
-               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
 
                HANDLE_EXCEPTION();
        }
@@ -2137,7 +2139,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CON
                func_name++;
                if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL)) {
                        SAVE_OPLINE();
-                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined function %s()", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                        HANDLE_EXCEPTION();
                } else {
                        fbc = Z_FUNC_P(func);
@@ -2169,7 +2171,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_FCALL_SPEC_CONST_HANDLER(
                fbc = CACHED_PTR(Z_CACHE_SLOT_P(fname));
        } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(fname))) == NULL)) {
            SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(fname));
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined function %s()", Z_STRVAL_P(fname));
                HANDLE_EXCEPTION();
        } else {
                fbc = Z_FUNC_P(func);
@@ -2314,7 +2316,7 @@ try_class_name:
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Class name must be a valid object or a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class name must be a valid object or a string");
                }
 
                CHECK_EXCEPTION();
@@ -2360,7 +2362,7 @@ try_class_name:
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Class name must be a valid object or a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class name must be a valid object or a string");
                }
 
                CHECK_EXCEPTION();
@@ -2414,7 +2416,7 @@ try_function_name:
                        }
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname));
                                }
                                zend_string_release(lcname);
                                zend_string_release(mname);
@@ -2431,8 +2433,9 @@ try_function_name:
                                                "Non-static method %s::%s() should not be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                } else {
-                                       zend_error(
-                                               E_EXCEPTION | E_ERROR,
+                                       zend_throw_error(
+                                               zend_ce_error,
+                                               E_EXCEPTION,
                                                "Non-static method %s::%s() cannot be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
 
@@ -2447,7 +2450,7 @@ try_function_name:
                                lcname = zend_string_tolower(Z_STR_P(function_name));
                        }
                        if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined function %s()", Z_STRVAL_P(function_name));
                                zend_string_release(lcname);
 
                                HANDLE_EXCEPTION();
@@ -2478,21 +2481,21 @@ try_function_name:
                method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
 
                if (!obj || !method) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Array callback has to contain indices 0 and 1");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Array callback has to contain indices 0 and 1");
 
                        HANDLE_EXCEPTION();
                }
 
                ZVAL_DEREF(obj);
                if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
-                       zend_error(E_EXCEPTION | E_ERROR, "First array member is not a valid class name or object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "First array member is not a valid class name or object");
 
                        HANDLE_EXCEPTION();
                }
 
                ZVAL_DEREF(method);
                if (Z_TYPE_P(method) != IS_STRING) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Second array member is not a valid method");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Second array member is not a valid method");
 
                        HANDLE_EXCEPTION();
                }
@@ -2512,7 +2515,7 @@ try_function_name:
                        }
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method));
                                }
 
                                HANDLE_EXCEPTION();
@@ -2523,8 +2526,9 @@ try_function_name:
                                                "Non-static method %s::%s() should not be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                } else {
-                                       zend_error(
-                                               E_EXCEPTION | E_ERROR,
+                                       zend_throw_error(
+                                               zend_ce_error,
+                                               E_EXCEPTION,
                                                "Non-static method %s::%s() cannot be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
 
@@ -2538,7 +2542,7 @@ try_function_name:
                        fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL);
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method));
                                }
 
                                HANDLE_EXCEPTION();
@@ -2562,7 +2566,7 @@ try_function_name:
                if (UNEXPECTED(EG(exception) != NULL)) {
                        HANDLE_EXCEPTION();
                }
-               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
 
                HANDLE_EXCEPTION();
        }
@@ -2613,7 +2617,7 @@ try_class_name:
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Class name must be a valid object or a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class name must be a valid object or a string");
                }
 
                zval_ptr_dtor_nogc(free_op2);
@@ -2668,7 +2672,7 @@ try_function_name:
                        }
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname));
                                }
                                zend_string_release(lcname);
                                zend_string_release(mname);
@@ -2685,8 +2689,9 @@ try_function_name:
                                                "Non-static method %s::%s() should not be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                } else {
-                                       zend_error(
-                                               E_EXCEPTION | E_ERROR,
+                                       zend_throw_error(
+                                               zend_ce_error,
+                                               E_EXCEPTION,
                                                "Non-static method %s::%s() cannot be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                        zval_ptr_dtor_nogc(free_op2);
@@ -2701,7 +2706,7 @@ try_function_name:
                                lcname = zend_string_tolower(Z_STR_P(function_name));
                        }
                        if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined function %s()", Z_STRVAL_P(function_name));
                                zend_string_release(lcname);
                                zval_ptr_dtor_nogc(free_op2);
                                HANDLE_EXCEPTION();
@@ -2732,21 +2737,21 @@ try_function_name:
                method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
 
                if (!obj || !method) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Array callback has to contain indices 0 and 1");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Array callback has to contain indices 0 and 1");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
 
                ZVAL_DEREF(obj);
                if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
-                       zend_error(E_EXCEPTION | E_ERROR, "First array member is not a valid class name or object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "First array member is not a valid class name or object");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
 
                ZVAL_DEREF(method);
                if (Z_TYPE_P(method) != IS_STRING) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Second array member is not a valid method");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Second array member is not a valid method");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
@@ -2766,7 +2771,7 @@ try_function_name:
                        }
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method));
                                }
                                zval_ptr_dtor_nogc(free_op2);
                                HANDLE_EXCEPTION();
@@ -2777,8 +2782,9 @@ try_function_name:
                                                "Non-static method %s::%s() should not be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                } else {
-                                       zend_error(
-                                               E_EXCEPTION | E_ERROR,
+                                       zend_throw_error(
+                                               zend_ce_error,
+                                               E_EXCEPTION,
                                                "Non-static method %s::%s() cannot be called statically",
                                                ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                        zval_ptr_dtor_nogc(free_op2);
@@ -2792,7 +2798,7 @@ try_function_name:
                        fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL);
                        if (UNEXPECTED(fbc == NULL)) {
                                if (EXPECTED(!EG(exception))) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method));
                                }
                                zval_ptr_dtor_nogc(free_op2);
                                HANDLE_EXCEPTION();
@@ -2816,7 +2822,7 @@ try_function_name:
                if (UNEXPECTED(EG(exception) != NULL)) {
                        HANDLE_EXCEPTION();
                }
-               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -3178,7 +3184,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDL
                retval_ptr = NULL;
 
                if (IS_CONST == IS_VAR && UNEXPECTED(retval_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot return string offsets by reference");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot return string offsets by reference");
                        HANDLE_EXCEPTION();
                }
 
@@ -3275,7 +3281,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Can only throw objects");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Can only throw objects");
 
                        HANDLE_EXCEPTION();
                }
@@ -3322,7 +3328,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_CONST_HANDLER
        } else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
 send_val_by_ref:
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot pass parameter %d by reference", opline->op2.num);
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot pass parameter %d by reference", opline->op2.num);
 
                arg = ZEND_CALL_VAR(EX(call), opline->result.var);
                ZVAL_UNDEF(arg);
@@ -3432,7 +3438,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_
        obj = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(obj) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                HANDLE_EXCEPTION();
        }
 
@@ -3451,7 +3457,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "__clone method called on non-object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "__clone method called on non-object");
 
                        HANDLE_EXCEPTION();
                }
@@ -3462,9 +3468,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_
        clone_call =  Z_OBJ_HT_P(obj)->clone_obj;
        if (UNEXPECTED(clone_call == NULL)) {
                if (ce) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
                } else {
-                       zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Trying to clone an uncloneable object");
                }
 
                HANDLE_EXCEPTION();
@@ -3475,7 +3481,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (UNEXPECTED(ce != EG(scope))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
 
                                HANDLE_EXCEPTION();
                        }
@@ -3483,7 +3489,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
 
                                HANDLE_EXCEPTION();
                        }
@@ -4171,13 +4177,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
 
                        if (Z_ISUNDEF(new_gen->retval)) {
                                if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
-                                       zend_error(E_ERROR | E_EXCEPTION, "Impossible to yield from the Generator being currently run");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Impossible to yield from the Generator being currently run");
                                        HANDLE_EXCEPTION();
                                } else {
                                        zend_generator_yield_from(generator, new_gen);
                                }
                        } else if (UNEXPECTED(new_gen->execute_data == NULL)) {
-                               zend_error(E_ERROR | E_EXCEPTION, "Generator passed to yield from was aborted without proper return and is unable to continue");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Generator passed to yield from was aborted without proper return and is unable to continue");
                                HANDLE_EXCEPTION();
                        } else {
                                if (RETURN_VALUE_USED(opline)) {
@@ -4190,7 +4196,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
 
                        if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
                                if (!EG(exception)) {
-                                       zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
                                }
                                HANDLE_EXCEPTION();
                        }
@@ -4207,7 +4213,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
                        ZVAL_OBJ(&generator->values, &iter->std);
                }
        } else {
-               zend_error(E_ERROR | E_EXCEPTION, "Can use \"yield from\" only with arrays and Traversables", 0);
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Can use \"yield from\" only with arrays and Traversables", 0);
                HANDLE_EXCEPTION();
        }
 
@@ -5009,7 +5015,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -5036,7 +5042,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -5201,14 +5207,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
         }
                container = NULL;
                if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -5220,7 +5226,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
 
        } else {
                if (IS_CONST == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
 
                        HANDLE_EXCEPTION();
@@ -5246,7 +5252,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CONST_H
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -5319,7 +5325,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CONST_
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -5395,18 +5401,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_
                container = NULL;
 
                if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                        HANDLE_EXCEPTION();
                }
                if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
                }
                if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                        HANDLE_EXCEPTION();
                }
@@ -5567,7 +5573,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CO
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
 
 
                        HANDLE_EXCEPTION();
@@ -5577,7 +5583,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CO
        object = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -5597,7 +5603,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CO
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
 
 
                                HANDLE_EXCEPTION();
@@ -5613,7 +5619,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CO
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
 
 
                        HANDLE_EXCEPTION();
@@ -5623,7 +5629,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CO
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
 
 
@@ -5677,7 +5683,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                                HANDLE_EXCEPTION();
                        }
                        if (UNEXPECTED(ce == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                HANDLE_EXCEPTION();
                        }
                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -5706,7 +5712,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
 
                                HANDLE_EXCEPTION();
                        }
@@ -5719,7 +5725,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                }
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
                        }
 
                        HANDLE_EXCEPTION();
@@ -5738,11 +5744,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                }
        } else {
                if (UNEXPECTED(ce->constructor == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call constructor");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call constructor");
                        HANDLE_EXCEPTION();
                }
                if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
                        HANDLE_EXCEPTION();
                }
                fbc = ce->constructor;
@@ -5763,8 +5769,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                        } else {
                                /* An internal function assumes $this is present and won't check that.
                                 * So PHP would crash by allowing the call. */
-                               zend_error(
-                                       E_EXCEPTION | E_ERROR,
+                               zend_throw_error(
+                                       zend_ce_error,
+                                       E_EXCEPTION,
                                        "Non-static method %s::%s() cannot be called statically",
                                        ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                HANDLE_EXCEPTION();
@@ -5938,7 +5945,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONS
                                CHECK_EXCEPTION();
                                ZEND_VM_NEXT_OPCODE();
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Undefined constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                HANDLE_EXCEPTION();
                        }
                } else {
@@ -5975,7 +5982,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONS
                                                HANDLE_EXCEPTION();
                                        }
                                        if (UNEXPECTED(ce == NULL)) {
-                                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                                HANDLE_EXCEPTION();
                                        }
                                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -6004,7 +6011,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONS
                                        CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce, value);
                                }
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined class constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                HANDLE_EXCEPTION();
                        }
                } while (0);
@@ -6032,7 +6039,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_C
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = NULL;
                if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -6209,7 +6216,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HAN
                                        HANDLE_EXCEPTION();
                                }
                                if (UNEXPECTED(ce == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                        if (IS_CONST != IS_CONST) {
                                                zend_string_release(Z_STR(tmp));
                                        }
@@ -6352,7 +6359,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CON
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -6489,7 +6496,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CO
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -6569,7 +6576,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
 
                HANDLE_EXCEPTION();
@@ -6604,7 +6611,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER
                                zval *value_ptr = NULL;
 
                                if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -6768,7 +6775,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(Z
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
 
                HANDLE_EXCEPTION();
@@ -6803,7 +6810,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(Z
                                zval *value_ptr = NULL;
 
                                if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
                                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                                        HANDLE_EXCEPTION();
                                }
@@ -6978,7 +6985,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -7005,7 +7012,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -7187,7 +7194,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDL
                                        HANDLE_EXCEPTION();
                                }
                                if (UNEXPECTED(ce == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                        if (IS_CONST != IS_CONST) {
                                                zend_string_release(Z_STR(tmp));
                                        }
@@ -7325,7 +7332,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(Z
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
 
                HANDLE_EXCEPTION();
@@ -7360,7 +7367,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(Z
                                zval *value_ptr = NULL;
 
                                if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
                                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                                        HANDLE_EXCEPTION();
                                }
@@ -7493,7 +7500,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -7520,7 +7527,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -7655,14 +7662,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
         }
                container = NULL;
                if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -7674,7 +7681,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
 
        } else {
                if (IS_UNUSED == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
 
                        HANDLE_EXCEPTION();
@@ -7709,7 +7716,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                                HANDLE_EXCEPTION();
                        }
                        if (UNEXPECTED(ce == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                HANDLE_EXCEPTION();
                        }
                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -7738,7 +7745,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
 
                                HANDLE_EXCEPTION();
                        }
@@ -7751,7 +7758,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                }
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
                        }
 
                        HANDLE_EXCEPTION();
@@ -7770,11 +7777,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                }
        } else {
                if (UNEXPECTED(ce->constructor == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call constructor");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call constructor");
                        HANDLE_EXCEPTION();
                }
                if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
                        HANDLE_EXCEPTION();
                }
                fbc = ce->constructor;
@@ -7795,8 +7802,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                        } else {
                                /* An internal function assumes $this is present and won't check that.
                                 * So PHP would crash by allowing the call. */
-                               zend_error(
-                                       E_EXCEPTION | E_ERROR,
+                               zend_throw_error(
+                                       zend_ce_error,
+                                       E_EXCEPTION,
                                        "Non-static method %s::%s() cannot be called statically",
                                        ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                HANDLE_EXCEPTION();
@@ -7881,7 +7889,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_U
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = NULL;
                if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -8058,7 +8066,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HA
                                        HANDLE_EXCEPTION();
                                }
                                if (UNEXPECTED(ce == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                        if (IS_CONST != IS_CONST) {
                                                zend_string_release(Z_STR(tmp));
                                        }
@@ -8219,7 +8227,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLE
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
 
                HANDLE_EXCEPTION();
@@ -8254,7 +8262,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLE
                                zval *value_ptr = NULL;
 
                                if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -9037,14 +9045,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
         }
                container = NULL;
                if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -9056,7 +9064,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
 
        } else {
                if (IS_CV == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
 
                        HANDLE_EXCEPTION();
@@ -9082,7 +9090,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CV_HAND
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -9155,7 +9163,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CV_HAN
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -9231,18 +9239,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_
                container = NULL;
 
                if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                        HANDLE_EXCEPTION();
                }
                if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
                }
                if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                        HANDLE_EXCEPTION();
                }
@@ -9358,7 +9366,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CV
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
 
 
                        HANDLE_EXCEPTION();
@@ -9368,7 +9376,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CV
        object = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -9388,7 +9396,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CV
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
 
 
                                HANDLE_EXCEPTION();
@@ -9404,7 +9412,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CV
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
 
 
                        HANDLE_EXCEPTION();
@@ -9414,7 +9422,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CV
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
 
 
@@ -9468,7 +9476,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                                HANDLE_EXCEPTION();
                        }
                        if (UNEXPECTED(ce == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                HANDLE_EXCEPTION();
                        }
                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -9497,7 +9505,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
 
                                HANDLE_EXCEPTION();
                        }
@@ -9510,7 +9518,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                }
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
                        }
 
                        HANDLE_EXCEPTION();
@@ -9529,11 +9537,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                }
        } else {
                if (UNEXPECTED(ce->constructor == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call constructor");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call constructor");
                        HANDLE_EXCEPTION();
                }
                if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
                        HANDLE_EXCEPTION();
                }
                fbc = ce->constructor;
@@ -9554,8 +9562,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                        } else {
                                /* An internal function assumes $this is present and won't check that.
                                 * So PHP would crash by allowing the call. */
-                               zend_error(
-                                       E_EXCEPTION | E_ERROR,
+                               zend_throw_error(
+                                       zend_ce_error,
+                                       E_EXCEPTION,
                                        "Non-static method %s::%s() cannot be called statically",
                                        ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                HANDLE_EXCEPTION();
@@ -9765,7 +9774,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_C
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = NULL;
                if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -9898,7 +9907,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CON
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -10035,7 +10044,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CO
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -10078,7 +10087,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZE
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
 
                HANDLE_EXCEPTION();
@@ -10113,7 +10122,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZE
                                zval *value_ptr = NULL;
 
                                if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -10870,14 +10879,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
 
                        HANDLE_EXCEPTION();
         }
                container = NULL;
                if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                        HANDLE_EXCEPTION();
                }
@@ -10889,7 +10898,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
 
        } else {
                if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
 
                        HANDLE_EXCEPTION();
@@ -10915,7 +10924,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_TMPVAR_
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -10989,7 +10998,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_TMPVAR
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -11066,18 +11075,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_
                container = NULL;
 
                if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
                if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
                        zval_ptr_dtor_nogc(free_op2);
 
                        HANDLE_EXCEPTION();
                }
                if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
@@ -11193,7 +11202,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_TM
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
                        zval_ptr_dtor_nogc(free_op2);
 
                        HANDLE_EXCEPTION();
@@ -11203,7 +11212,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_TM
        object = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -11223,7 +11232,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_TM
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
                                zval_ptr_dtor_nogc(free_op2);
 
                                HANDLE_EXCEPTION();
@@ -11239,7 +11248,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_TM
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
                        zval_ptr_dtor_nogc(free_op2);
 
                        HANDLE_EXCEPTION();
@@ -11249,7 +11258,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_TM
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
                        zval_ptr_dtor_nogc(free_op2);
 
@@ -11304,7 +11313,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                                HANDLE_EXCEPTION();
                        }
                        if (UNEXPECTED(ce == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                HANDLE_EXCEPTION();
                        }
                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -11333,7 +11342,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
                                zval_ptr_dtor_nogc(free_op2);
                                HANDLE_EXCEPTION();
                        }
@@ -11346,7 +11355,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                }
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
                        }
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
@@ -11365,11 +11374,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                }
        } else {
                if (UNEXPECTED(ce->constructor == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call constructor");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call constructor");
                        HANDLE_EXCEPTION();
                }
                if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
                        HANDLE_EXCEPTION();
                }
                fbc = ce->constructor;
@@ -11390,8 +11399,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
                        } else {
                                /* An internal function assumes $this is present and won't check that.
                                 * So PHP would crash by allowing the call. */
-                               zend_error(
-                                       E_EXCEPTION | E_ERROR,
+                               zend_throw_error(
+                                       zend_ce_error,
+                                       E_EXCEPTION,
                                        "Non-static method %s::%s() cannot be called statically",
                                        ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                HANDLE_EXCEPTION();
@@ -11551,7 +11561,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_T
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = NULL;
                if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -11684,7 +11694,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CON
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -11821,7 +11831,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CO
        container = EX_CONSTANT(opline->op1);
 
        if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -11955,7 +11965,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER
                retval_ptr = NULL;
 
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(retval_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot return string offsets by reference");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot return string offsets by reference");
                        HANDLE_EXCEPTION();
                }
 
@@ -12052,7 +12062,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OP
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Can only throw objects");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Can only throw objects");
                        zval_ptr_dtor_nogc(free_op1);
                        HANDLE_EXCEPTION();
                }
@@ -12099,7 +12109,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_TMP_HANDLER(Z
        } else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
 send_val_by_ref:
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot pass parameter %d by reference", opline->op2.num);
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot pass parameter %d by reference", opline->op2.num);
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                arg = ZEND_CALL_VAR(EX(call), opline->result.var);
                ZVAL_UNDEF(arg);
@@ -12640,13 +12650,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZE
 
                        if (Z_ISUNDEF(new_gen->retval)) {
                                if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
-                                       zend_error(E_ERROR | E_EXCEPTION, "Impossible to yield from the Generator being currently run");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Impossible to yield from the Generator being currently run");
                                        HANDLE_EXCEPTION();
                                } else {
                                        zend_generator_yield_from(generator, new_gen);
                                }
                        } else if (UNEXPECTED(new_gen->execute_data == NULL)) {
-                               zend_error(E_ERROR | E_EXCEPTION, "Generator passed to yield from was aborted without proper return and is unable to continue");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Generator passed to yield from was aborted without proper return and is unable to continue");
                                HANDLE_EXCEPTION();
                        } else {
                                if (RETURN_VALUE_USED(opline)) {
@@ -12660,7 +12670,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZE
 
                        if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
                                if (!EG(exception)) {
-                                       zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
                                }
                                HANDLE_EXCEPTION();
                        }
@@ -12677,7 +12687,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZE
                        ZVAL_OBJ(&generator->values, &iter->std);
                }
        } else {
-               zend_error(E_ERROR | E_EXCEPTION, "Can use \"yield from\" only with arrays and Traversables", 0);
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Can use \"yield from\" only with arrays and Traversables", 0);
                HANDLE_EXCEPTION();
        }
 
@@ -12787,14 +12797,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_CO
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
         }
                container = NULL;
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -12806,7 +12816,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_CO
 
        } else {
                if (IS_CONST == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
@@ -12832,7 +12842,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_CONST_HAN
        container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
 
        if (IS_TMP_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -12908,18 +12918,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CO
                container = NULL;
 
                if (IS_TMP_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                        HANDLE_EXCEPTION();
                }
                if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
                }
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                        HANDLE_EXCEPTION();
                }
@@ -13028,7 +13038,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CON
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = NULL;
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -13156,7 +13166,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
@@ -13191,7 +13201,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
                                zval *value_ptr = NULL;
 
                                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -13339,7 +13349,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
@@ -13374,7 +13384,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
                                zval *value_ptr = NULL;
 
                                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
                                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                                        HANDLE_EXCEPTION();
                                }
@@ -13522,7 +13532,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEN
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
@@ -13557,7 +13567,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEN
                                zval *value_ptr = NULL;
 
                                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
                                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                                        HANDLE_EXCEPTION();
                                }
@@ -13665,14 +13675,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UN
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
         }
                container = NULL;
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -13684,7 +13694,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UN
 
        } else {
                if (IS_UNUSED == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
@@ -13758,7 +13768,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNU
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = NULL;
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -13886,7 +13896,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
@@ -13921,7 +13931,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
                                zval *value_ptr = NULL;
 
                                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -14071,14 +14081,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_CV
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
         }
                container = NULL;
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -14090,7 +14100,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_CV
 
        } else {
                if (IS_CV == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
@@ -14116,7 +14126,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_CV_HANDLE
        container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
 
        if (IS_TMP_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -14192,18 +14202,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CV
                container = NULL;
 
                if (IS_TMP_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                        HANDLE_EXCEPTION();
                }
                if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
                }
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                        HANDLE_EXCEPTION();
                }
@@ -14312,7 +14322,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = NULL;
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -14440,7 +14450,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
@@ -14475,7 +14485,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
                                zval *value_ptr = NULL;
 
                                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -14583,14 +14593,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_TM
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
         }
                container = NULL;
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                        HANDLE_EXCEPTION();
                }
@@ -14602,7 +14612,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_TM
 
        } else {
                if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
@@ -14628,7 +14638,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_TMPVAR_HA
        container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
 
        if (IS_TMP_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -14705,18 +14715,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_TM
                container = NULL;
 
                if (IS_TMP_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
                if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
                        zval_ptr_dtor_nogc(free_op2);
 
                        HANDLE_EXCEPTION();
                }
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
@@ -14825,7 +14835,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = NULL;
                if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -14955,7 +14965,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_
 
        if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -15002,7 +15012,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_
 
        if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -15049,7 +15059,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND
 
        if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -15089,7 +15099,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND
 
        if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -15201,7 +15211,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER
                retval_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
                if (IS_VAR == IS_VAR && UNEXPECTED(retval_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot return string offsets by reference");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot return string offsets by reference");
                        HANDLE_EXCEPTION();
                }
 
@@ -15299,7 +15309,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OP
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Can only throw objects");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Can only throw objects");
                        zval_ptr_dtor_nogc(free_op1);
                        HANDLE_EXCEPTION();
                }
@@ -15404,7 +15414,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND
        varptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(varptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Only variables can be passed by reference");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Only variables can be passed by reference");
                HANDLE_EXCEPTION();
        }
 
@@ -16484,13 +16494,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZE
 
                        if (Z_ISUNDEF(new_gen->retval)) {
                                if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
-                                       zend_error(E_ERROR | E_EXCEPTION, "Impossible to yield from the Generator being currently run");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Impossible to yield from the Generator being currently run");
                                        HANDLE_EXCEPTION();
                                } else {
                                        zend_generator_yield_from(generator, new_gen);
                                }
                        } else if (UNEXPECTED(new_gen->execute_data == NULL)) {
-                               zend_error(E_ERROR | E_EXCEPTION, "Generator passed to yield from was aborted without proper return and is unable to continue");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Generator passed to yield from was aborted without proper return and is unable to continue");
                                HANDLE_EXCEPTION();
                        } else {
                                if (RETURN_VALUE_USED(opline)) {
@@ -16504,7 +16514,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZE
 
                        if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
                                if (!EG(exception)) {
-                                       zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
                                }
                                HANDLE_EXCEPTION();
                        }
@@ -16521,7 +16531,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZE
                        ZVAL_OBJ(&generator->values, &iter->std);
                }
        } else {
-               zend_error(E_ERROR | E_EXCEPTION, "Can use \"yield from\" only with arrays and Traversables", 0);
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Can use \"yield from\" only with arrays and Traversables", 0);
                HANDLE_EXCEPTION();
        }
 
@@ -16634,7 +16644,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -16643,7 +16653,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        property = EX_CONSTANT(opline->op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -16698,13 +16708,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -16730,7 +16740,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                        FREE_OP(free_op_data1);
                        if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
@@ -16772,7 +16782,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_V
        var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -17029,7 +17039,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -17037,7 +17047,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        property = EX_CONSTANT(opline->op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -17110,7 +17120,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -17118,7 +17128,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        property = EX_CONSTANT(opline->op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -17185,7 +17195,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HAN
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2), IS_CONST);
@@ -17208,7 +17218,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CONST_HA
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2), IS_CONST);
@@ -17231,14 +17241,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CO
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
         }
                container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
                if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -17250,7 +17260,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CO
                if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
        } else {
                if (IS_CONST == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
@@ -17274,7 +17284,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                HANDLE_EXCEPTION();
        }
@@ -17300,7 +17310,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CONST_HAN
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -17373,12 +17383,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HAN
 
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -17405,12 +17415,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CONST_HA
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -17439,18 +17449,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CO
                container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
                if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                        HANDLE_EXCEPTION();
                }
                if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
                        if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
                        HANDLE_EXCEPTION();
                }
                if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                        HANDLE_EXCEPTION();
                }
@@ -17477,7 +17487,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -17485,7 +17495,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST
        property = EX_CONSTANT(opline->op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -17510,7 +17520,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HAND
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -17518,7 +17528,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HAND
        property_name = EX_CONSTANT(opline->op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                HANDLE_EXCEPTION();
        }
@@ -17545,7 +17555,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HAND
        object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -17594,7 +17604,7 @@ try_assign_dim_array:
                } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
                        if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) {
                                if (IS_CONST == IS_UNUSED) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "[] operator not supported for strings");
                                        FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                                        if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
                                        HANDLE_EXCEPTION();
@@ -17689,7 +17699,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                                HANDLE_EXCEPTION();
                        }
                        if (UNEXPECTED(ce == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                HANDLE_EXCEPTION();
                        }
                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -17718,7 +17728,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
 
                                HANDLE_EXCEPTION();
                        }
@@ -17731,7 +17741,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                }
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
                        }
 
                        HANDLE_EXCEPTION();
@@ -17750,11 +17760,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                }
        } else {
                if (UNEXPECTED(ce->constructor == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call constructor");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call constructor");
                        HANDLE_EXCEPTION();
                }
                if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
                        HANDLE_EXCEPTION();
                }
                fbc = ce->constructor;
@@ -17775,8 +17785,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                        } else {
                                /* An internal function assumes $this is present and won't check that.
                                 * So PHP would crash by allowing the call. */
-                               zend_error(
-                                       E_EXCEPTION | E_ERROR,
+                               zend_throw_error(
+                                       zend_ce_error,
+                                       E_EXCEPTION,
                                        "Non-static method %s::%s() cannot be called statically",
                                        ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                HANDLE_EXCEPTION();
@@ -17827,7 +17838,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_
                                CHECK_EXCEPTION();
                                ZEND_VM_NEXT_OPCODE();
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Undefined constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                HANDLE_EXCEPTION();
                        }
                } else {
@@ -17864,7 +17875,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_
                                                HANDLE_EXCEPTION();
                                        }
                                        if (UNEXPECTED(ce == NULL)) {
-                                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                                HANDLE_EXCEPTION();
                                        }
                                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -17893,7 +17904,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_
                                        CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce, value);
                                }
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined class constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                HANDLE_EXCEPTION();
                        }
                } while (0);
@@ -17921,7 +17932,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CON
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
                if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -18053,12 +18064,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDL
        SAVE_OPLINE();
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -18126,12 +18137,12 @@ num_index_dim:
                }
                if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                        if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        } else {
                                Z_OBJ_HT_P(container)->unset_dimension(container, offset);
                        }
                } else if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                }
        } while (0);
 
@@ -18150,12 +18161,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDL
        SAVE_OPLINE();
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -18192,7 +18203,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
@@ -18227,7 +18238,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
                                zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
                                if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -18410,7 +18421,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
@@ -18445,7 +18456,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
                                zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
                                if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
                                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                                        HANDLE_EXCEPTION();
                                }
@@ -18626,7 +18637,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLE
        value_ptr = _get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets nor overloaded objects");
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
        }
@@ -18647,14 +18658,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLE
 
        variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets nor overloaded objects");
                if (free_op2) {zval_ptr_dtor_nogc(free_op2);};
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR &&
            UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT) &&
            UNEXPECTED(!Z_ISREF_P(variable_ptr))) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot assign by reference to overloaded object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot assign by reference to overloaded object");
                if (free_op2) {zval_ptr_dtor_nogc(free_op2);};
                if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
                HANDLE_EXCEPTION();
@@ -18685,7 +18696,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEN
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
@@ -18720,7 +18731,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEN
                                zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
                                if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
                                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                                        HANDLE_EXCEPTION();
                                }
@@ -18829,13 +18840,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -18861,7 +18872,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                        FREE_OP(free_op_data1);
                        if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
@@ -19121,7 +19132,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HA
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, NULL, IS_UNUSED);
@@ -19144,7 +19155,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_H
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, NULL, IS_UNUSED);
@@ -19167,14 +19178,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UN
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
         }
                container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
                if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -19186,7 +19197,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UN
                if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
        } else {
                if (IS_UNUSED == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
@@ -19214,7 +19225,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HAN
        object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -19263,7 +19274,7 @@ try_assign_dim_array:
                } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
                        if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) {
                                if (IS_UNUSED == IS_UNUSED) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "[] operator not supported for strings");
                                        FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                                        if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
                                        HANDLE_EXCEPTION();
@@ -19329,7 +19340,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                                HANDLE_EXCEPTION();
                        }
                        if (UNEXPECTED(ce == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                HANDLE_EXCEPTION();
                        }
                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -19358,7 +19369,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
 
                                HANDLE_EXCEPTION();
                        }
@@ -19371,7 +19382,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                }
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
                        }
 
                        HANDLE_EXCEPTION();
@@ -19390,11 +19401,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                }
        } else {
                if (UNEXPECTED(ce->constructor == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call constructor");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call constructor");
                        HANDLE_EXCEPTION();
                }
                if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
                        HANDLE_EXCEPTION();
                }
                fbc = ce->constructor;
@@ -19415,8 +19426,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                        } else {
                                /* An internal function assumes $this is present and won't check that.
                                 * So PHP would crash by allowing the call. */
-                               zend_error(
-                                       E_EXCEPTION | E_ERROR,
+                               zend_throw_error(
+                                       zend_ce_error,
+                                       E_EXCEPTION,
                                        "Non-static method %s::%s() cannot be called statically",
                                        ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                HANDLE_EXCEPTION();
@@ -19501,7 +19513,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNU
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
                if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -19646,7 +19658,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
@@ -19681,7 +19693,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
                                zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
                                if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -19835,7 +19847,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -19844,7 +19856,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -19899,13 +19911,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -19931,7 +19943,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                        FREE_OP(free_op_data1);
                        if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
@@ -19973,7 +19985,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_V
        var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -20230,7 +20242,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -20238,7 +20250,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -20311,7 +20323,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -20319,7 +20331,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -20386,7 +20398,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CV_HANDLE
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var), IS_CV);
@@ -20409,7 +20421,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CV_HANDL
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var), IS_CV);
@@ -20432,14 +20444,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
         }
                container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
                if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -20451,7 +20463,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV
                if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
        } else {
                if (IS_CV == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
@@ -20475,7 +20487,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HA
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                HANDLE_EXCEPTION();
        }
@@ -20501,7 +20513,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CV_HANDLE
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -20574,12 +20586,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLE
 
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -20606,12 +20618,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CV_HANDL
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -20640,18 +20652,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV
                container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
                if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                        HANDLE_EXCEPTION();
                }
                if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
                        if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
                        HANDLE_EXCEPTION();
                }
                if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                        HANDLE_EXCEPTION();
                }
@@ -20678,7 +20690,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HA
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -20686,7 +20698,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HA
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -20711,7 +20723,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_HANDLER
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -20719,7 +20731,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_HANDLER
        property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                HANDLE_EXCEPTION();
        }
@@ -20746,7 +20758,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER
        object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -20795,7 +20807,7 @@ try_assign_dim_array:
                } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
                        if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) {
                                if (IS_CV == IS_UNUSED) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "[] operator not supported for strings");
                                        FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                                        if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
                                        HANDLE_EXCEPTION();
@@ -20880,7 +20892,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER
        value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op2.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets nor overloaded objects");
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
        }
@@ -20901,14 +20913,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER
 
        variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets nor overloaded objects");
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR &&
            UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT) &&
            UNEXPECTED(!Z_ISREF_P(variable_ptr))) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot assign by reference to overloaded object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot assign by reference to overloaded object");
 
                if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
                HANDLE_EXCEPTION();
@@ -20951,7 +20963,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                                HANDLE_EXCEPTION();
                        }
                        if (UNEXPECTED(ce == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                HANDLE_EXCEPTION();
                        }
                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -20980,7 +20992,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
 
                                HANDLE_EXCEPTION();
                        }
@@ -20993,7 +21005,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                }
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
                        }
 
                        HANDLE_EXCEPTION();
@@ -21012,11 +21024,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                }
        } else {
                if (UNEXPECTED(ce->constructor == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call constructor");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call constructor");
                        HANDLE_EXCEPTION();
                }
                if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
                        HANDLE_EXCEPTION();
                }
                fbc = ce->constructor;
@@ -21037,8 +21049,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                        } else {
                                /* An internal function assumes $this is present and won't check that.
                                 * So PHP would crash by allowing the call. */
-                               zend_error(
-                                       E_EXCEPTION | E_ERROR,
+                               zend_throw_error(
+                                       zend_ce_error,
+                                       E_EXCEPTION,
                                        "Non-static method %s::%s() cannot be called statically",
                                        ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                HANDLE_EXCEPTION();
@@ -21074,7 +21087,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
                if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -21206,12 +21219,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(
        SAVE_OPLINE();
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -21279,12 +21292,12 @@ num_index_dim:
                }
                if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                        if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        } else {
                                Z_OBJ_HT_P(container)->unset_dimension(container, offset);
                        }
                } else if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                }
        } while (0);
 
@@ -21303,12 +21316,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(
        SAVE_OPLINE();
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -21345,7 +21358,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                HANDLE_EXCEPTION();
@@ -21380,7 +21393,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
                                zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
                                if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -21497,7 +21510,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
@@ -21506,7 +21519,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
@@ -21561,13 +21574,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
@@ -21593,7 +21606,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
                        zval_ptr_dtor_nogc(free_op2);
                        FREE_OP(free_op_data1);
                        if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
@@ -21636,7 +21649,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_V
        var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -21894,7 +21907,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -21902,7 +21915,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -21976,7 +21989,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -21984,7 +21997,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -22052,7 +22065,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_TMPVAR_HA
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2), (IS_TMP_VAR|IS_VAR));
@@ -22075,7 +22088,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_TMPVAR_H
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2), (IS_TMP_VAR|IS_VAR));
@@ -22098,14 +22111,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TM
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
         }
                container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
                if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                        HANDLE_EXCEPTION();
                }
@@ -22117,7 +22130,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TM
                if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
        } else {
                if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
@@ -22141,7 +22154,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMPVA
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -22167,7 +22180,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_TMPVAR_HA
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -22241,12 +22254,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMPVAR_HA
 
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -22273,12 +22286,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_TMPVAR_H
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -22307,18 +22320,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TM
                container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
                if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
                if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
                        zval_ptr_dtor_nogc(free_op2);
                        if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
                        HANDLE_EXCEPTION();
                }
                if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
@@ -22345,7 +22358,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMPVA
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -22353,7 +22366,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMPVA
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -22378,7 +22391,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_HAN
        object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -22386,7 +22399,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_HAN
        property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -22413,7 +22426,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_HAN
        object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
@@ -22462,7 +22475,7 @@ try_assign_dim_array:
                } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
                        if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) {
                                if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "[] operator not supported for strings");
                                        FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                                        if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
                                        HANDLE_EXCEPTION();
@@ -22528,7 +22541,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                                HANDLE_EXCEPTION();
                        }
                        if (UNEXPECTED(ce == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                HANDLE_EXCEPTION();
                        }
                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -22557,7 +22570,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Function name must be a string");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Function name must be a string");
                                zval_ptr_dtor_nogc(free_op2);
                                HANDLE_EXCEPTION();
                        }
@@ -22570,7 +22583,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                }
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
                        }
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
@@ -22589,11 +22602,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                }
        } else {
                if (UNEXPECTED(ce->constructor == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call constructor");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call constructor");
                        HANDLE_EXCEPTION();
                }
                if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
                        HANDLE_EXCEPTION();
                }
                fbc = ce->constructor;
@@ -22614,8 +22627,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
                        } else {
                                /* An internal function assumes $this is present and won't check that.
                                 * So PHP would crash by allowing the call. */
-                               zend_error(
-                                       E_EXCEPTION | E_ERROR,
+                               zend_throw_error(
+                                       zend_ce_error,
+                                       E_EXCEPTION,
                                        "Non-static method %s::%s() cannot be called statically",
                                        ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
                                HANDLE_EXCEPTION();
@@ -22651,7 +22665,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
                if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -22783,12 +22797,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMPVAR_HAND
        SAVE_OPLINE();
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -22856,12 +22870,12 @@ num_index_dim:
                }
                if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                        if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        } else {
                                Z_OBJ_HT_P(container)->unset_dimension(container, offset);
                        }
                } else if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                }
        } while (0);
 
@@ -22881,12 +22895,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMPVAR_HAND
        SAVE_OPLINE();
        container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1);
        if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
        if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -22934,7 +22948,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND
        obj = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(obj) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                HANDLE_EXCEPTION();
        }
 
@@ -22953,7 +22967,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "__clone method called on non-object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "__clone method called on non-object");
 
                        HANDLE_EXCEPTION();
                }
@@ -22964,9 +22978,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND
        clone_call =  Z_OBJ_HT_P(obj)->clone_obj;
        if (UNEXPECTED(clone_call == NULL)) {
                if (ce) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
                } else {
-                       zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Trying to clone an uncloneable object");
                }
 
                HANDLE_EXCEPTION();
@@ -22977,7 +22991,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (UNEXPECTED(ce != EG(scope))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
 
                                HANDLE_EXCEPTION();
                        }
@@ -22985,7 +22999,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
 
                                HANDLE_EXCEPTION();
                        }
@@ -23047,7 +23061,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -23056,7 +23070,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        property = EX_CONSTANT(opline->op2);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -23111,13 +23125,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -23143,7 +23157,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                        FREE_OP(free_op_data1);
 
@@ -23405,7 +23419,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -23413,7 +23427,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        property = EX_CONSTANT(opline->op2);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -23486,7 +23500,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -23494,7 +23508,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        property = EX_CONSTANT(opline->op2);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -23563,7 +23577,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -23636,12 +23650,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_
 
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -23668,12 +23682,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -23699,7 +23713,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -23775,18 +23789,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED
                container = _get_obj_zval_ptr_unused(execute_data);
 
                if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                        HANDLE_EXCEPTION();
                }
                if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
                }
                if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                        HANDLE_EXCEPTION();
                }
@@ -23813,7 +23827,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CO
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -23821,7 +23835,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CO
        property = EX_CONSTANT(opline->op2);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -23846,7 +23860,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_H
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -23854,7 +23868,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_H
        property_name = EX_CONSTANT(opline->op2);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                HANDLE_EXCEPTION();
        }
@@ -23931,7 +23945,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
 
 
                        HANDLE_EXCEPTION();
@@ -23941,7 +23955,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -23961,7 +23975,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
 
 
                                HANDLE_EXCEPTION();
@@ -23977,7 +23991,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
 
 
                        HANDLE_EXCEPTION();
@@ -23987,7 +24001,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
 
 
@@ -24046,7 +24060,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CON
                                CHECK_EXCEPTION();
                                ZEND_VM_NEXT_OPCODE();
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Undefined constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                HANDLE_EXCEPTION();
                        }
                } else {
@@ -24083,7 +24097,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CON
                                                HANDLE_EXCEPTION();
                                        }
                                        if (UNEXPECTED(ce == NULL)) {
-                                               zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
+                                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
                                                HANDLE_EXCEPTION();
                                        }
                                        CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
@@ -24112,7 +24126,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CON
                                        CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce, value);
                                }
                        } else {
-                               zend_error(E_EXCEPTION | E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Undefined class constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                HANDLE_EXCEPTION();
                        }
                } while (0);
@@ -24172,12 +24186,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HA
        SAVE_OPLINE();
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -24245,12 +24259,12 @@ num_index_dim:
                }
                if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                        if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        } else {
                                Z_OBJ_HT_P(container)->unset_dimension(container, offset);
                        }
                } else if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                }
        } while (0);
 
@@ -24269,12 +24283,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HA
        SAVE_OPLINE();
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -24316,7 +24330,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNU
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -24453,7 +24467,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UN
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -24496,7 +24510,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLE
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
 
                HANDLE_EXCEPTION();
@@ -24531,7 +24545,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLE
                                zval *value_ptr = NULL;
 
                                if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -24637,7 +24651,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
 
                HANDLE_EXCEPTION();
@@ -24672,7 +24686,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(
                                zval *value_ptr = NULL;
 
                                if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
                                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                                        HANDLE_EXCEPTION();
                                }
@@ -24778,7 +24792,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
 
                HANDLE_EXCEPTION();
@@ -24813,7 +24827,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(
                                zval *value_ptr = NULL;
 
                                if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
                                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                                        HANDLE_EXCEPTION();
                                }
@@ -24921,13 +24935,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -24953,7 +24967,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                        FREE_OP(free_op_data1);
 
@@ -25291,7 +25305,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDL
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
 
                HANDLE_EXCEPTION();
@@ -25326,7 +25340,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDL
                                zval *value_ptr = NULL;
 
                                if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -25437,7 +25451,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -25446,7 +25460,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -25501,13 +25515,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -25533,7 +25547,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                        FREE_OP(free_op_data1);
 
@@ -25795,7 +25809,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -25803,7 +25817,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -25876,7 +25890,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -25884,7 +25898,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -25953,7 +25967,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HAN
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -26026,12 +26040,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HAN
 
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -26058,12 +26072,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HA
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -26089,7 +26103,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HA
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -26165,18 +26179,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED
                container = _get_obj_zval_ptr_unused(execute_data);
 
                if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                        HANDLE_EXCEPTION();
                }
                if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
                }
                if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                        HANDLE_EXCEPTION();
                }
@@ -26203,7 +26217,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -26211,7 +26225,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -26236,7 +26250,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_HAND
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -26244,7 +26258,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_HAND
        property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                HANDLE_EXCEPTION();
        }
@@ -26321,7 +26335,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
 
 
                        HANDLE_EXCEPTION();
@@ -26331,7 +26345,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -26351,7 +26365,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
 
 
                                HANDLE_EXCEPTION();
@@ -26367,7 +26381,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
 
 
                        HANDLE_EXCEPTION();
@@ -26377,7 +26391,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
 
 
@@ -26453,12 +26467,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDL
        SAVE_OPLINE();
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -26526,12 +26540,12 @@ num_index_dim:
                }
                if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                        if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        } else {
                                Z_OBJ_HT_P(container)->unset_dimension(container, offset);
                        }
                } else if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                }
        } while (0);
 
@@ -26550,12 +26564,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDL
        SAVE_OPLINE();
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -26597,7 +26611,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNU
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -26734,7 +26748,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UN
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -26777,7 +26791,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(Z
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
 
                HANDLE_EXCEPTION();
@@ -26812,7 +26826,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(Z
                                zval *value_ptr = NULL;
 
                                if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -26923,7 +26937,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
@@ -26932,7 +26946,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
@@ -26987,13 +27001,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
@@ -27019,7 +27033,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
                        zval_ptr_dtor_nogc(free_op2);
                        FREE_OP(free_op_data1);
 
@@ -27282,7 +27296,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -27290,7 +27304,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -27364,7 +27378,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -27372,7 +27386,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -27442,7 +27456,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMPVAR
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -27516,12 +27530,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMPVAR
 
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -27548,12 +27562,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMPVA
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -27579,7 +27593,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMPVA
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -27656,18 +27670,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED
                container = _get_obj_zval_ptr_unused(execute_data);
 
                if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
                if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
                        zval_ptr_dtor_nogc(free_op2);
 
                        HANDLE_EXCEPTION();
                }
                if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
@@ -27694,7 +27708,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TM
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -27702,7 +27716,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TM
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -27727,7 +27741,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -27735,7 +27749,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
        property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -27812,7 +27826,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
                        zval_ptr_dtor_nogc(free_op2);
 
                        HANDLE_EXCEPTION();
@@ -27822,7 +27836,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
        object = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -27842,7 +27856,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
                                zval_ptr_dtor_nogc(free_op2);
 
                                HANDLE_EXCEPTION();
@@ -27858,7 +27872,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
                        zval_ptr_dtor_nogc(free_op2);
 
                        HANDLE_EXCEPTION();
@@ -27868,7 +27882,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
                        zval_ptr_dtor_nogc(free_op2);
 
@@ -27945,12 +27959,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMPVAR_H
        SAVE_OPLINE();
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -28018,12 +28032,12 @@ num_index_dim:
                }
                if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                        if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        } else {
                                Z_OBJ_HT_P(container)->unset_dimension(container, offset);
                        }
                } else if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                }
        } while (0);
 
@@ -28043,12 +28057,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMPVAR_H
        SAVE_OPLINE();
        container = _get_obj_zval_ptr_unused(execute_data);
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
        if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -28091,7 +28105,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNU
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -28228,7 +28242,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UN
        container = _get_obj_zval_ptr_unused(execute_data);
 
        if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -28312,7 +28326,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_O
 
        if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -28358,7 +28372,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_O
 
        if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -28404,7 +28418,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_SPEC_CV_HANDLER(ZEND_
 
        if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -28443,7 +28457,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_DEC_SPEC_CV_HANDLER(ZEND_
 
        if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
                SAVE_OPLINE();
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                HANDLE_EXCEPTION();
        }
 
@@ -28783,7 +28797,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(
                retval_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var);
 
                if (IS_CV == IS_VAR && UNEXPECTED(retval_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot return string offsets by reference");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot return string offsets by reference");
                        HANDLE_EXCEPTION();
                }
 
@@ -28880,7 +28894,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPC
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Can only throw objects");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Can only throw objects");
 
                        HANDLE_EXCEPTION();
                }
@@ -28985,7 +28999,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_
        varptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(varptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Only variables can be passed by reference");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Only variables can be passed by reference");
                HANDLE_EXCEPTION();
        }
 
@@ -29148,7 +29162,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
        obj = _get_zval_ptr_cv_undef(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(obj) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                HANDLE_EXCEPTION();
        }
 
@@ -29167,7 +29181,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "__clone method called on non-object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "__clone method called on non-object");
 
                        HANDLE_EXCEPTION();
                }
@@ -29178,9 +29192,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
        clone_call =  Z_OBJ_HT_P(obj)->clone_obj;
        if (UNEXPECTED(clone_call == NULL)) {
                if (ce) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
                } else {
-                       zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Trying to clone an uncloneable object");
                }
 
                HANDLE_EXCEPTION();
@@ -29191,7 +29205,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (UNEXPECTED(ce != EG(scope))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
 
                                HANDLE_EXCEPTION();
                        }
@@ -29199,7 +29213,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
 
                                HANDLE_EXCEPTION();
                        }
@@ -29887,13 +29901,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
 
                        if (Z_ISUNDEF(new_gen->retval)) {
                                if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
-                                       zend_error(E_ERROR | E_EXCEPTION, "Impossible to yield from the Generator being currently run");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Impossible to yield from the Generator being currently run");
                                        HANDLE_EXCEPTION();
                                } else {
                                        zend_generator_yield_from(generator, new_gen);
                                }
                        } else if (UNEXPECTED(new_gen->execute_data == NULL)) {
-                               zend_error(E_ERROR | E_EXCEPTION, "Generator passed to yield from was aborted without proper return and is unable to continue");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Generator passed to yield from was aborted without proper return and is unable to continue");
                                HANDLE_EXCEPTION();
                        } else {
                                if (RETURN_VALUE_USED(opline)) {
@@ -29906,7 +29920,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
 
                        if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
                                if (!EG(exception)) {
-                                       zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
                                }
                                HANDLE_EXCEPTION();
                        }
@@ -29923,7 +29937,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
                        ZVAL_OBJ(&generator->values, &iter->std);
                }
        } else {
-               zend_error(E_ERROR | E_EXCEPTION, "Can use \"yield from\" only with arrays and Traversables", 0);
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Can use \"yield from\" only with arrays and Traversables", 0);
                HANDLE_EXCEPTION();
        }
 
@@ -30683,7 +30697,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -30692,7 +30706,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        property = EX_CONSTANT(opline->op2);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -30747,13 +30761,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -30779,7 +30793,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                        FREE_OP(free_op_data1);
 
@@ -30821,7 +30835,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_C
        var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -31078,7 +31092,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -31086,7 +31100,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        property = EX_CONSTANT(opline->op2);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -31159,7 +31173,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -31167,7 +31181,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        property = EX_CONSTANT(opline->op2);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -31259,7 +31273,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -31286,7 +31300,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -31436,7 +31450,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CONST_HAND
        container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2), IS_CONST);
@@ -31459,7 +31473,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HAN
        container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2), IS_CONST);
@@ -31497,14 +31511,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CON
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
         }
                container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
                if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -31516,7 +31530,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CON
 
        } else {
                if (IS_CONST == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
 
                        HANDLE_EXCEPTION();
@@ -31540,7 +31554,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                HANDLE_EXCEPTION();
        }
@@ -31566,7 +31580,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CONST_HAND
        container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -31639,12 +31653,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HAND
 
        container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -31671,12 +31685,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HAN
        container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -31702,7 +31716,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HAN
        container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -31778,18 +31792,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CON
                container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
                if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                        HANDLE_EXCEPTION();
                }
                if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
                }
                if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                        HANDLE_EXCEPTION();
                }
@@ -31816,7 +31830,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -31824,7 +31838,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_
        property = EX_CONSTANT(opline->op2);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -31894,7 +31908,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDL
        object = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -31902,7 +31916,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDL
        property_name = EX_CONSTANT(opline->op2);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                HANDLE_EXCEPTION();
        }
@@ -31929,7 +31943,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDL
        object_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -31978,7 +31992,7 @@ try_assign_dim_array:
                } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
                        if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) {
                                if (IS_CONST == IS_UNUSED) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "[] operator not supported for strings");
                                        FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                                        HANDLE_EXCEPTION();
@@ -32151,7 +32165,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
 
 
                        HANDLE_EXCEPTION();
@@ -32161,7 +32175,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST
        object = _get_zval_ptr_cv_undef(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -32181,7 +32195,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
 
 
                                HANDLE_EXCEPTION();
@@ -32197,7 +32211,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
 
 
                        HANDLE_EXCEPTION();
@@ -32207,7 +32221,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
 
 
@@ -32318,7 +32332,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONS
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var);
                if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -32495,7 +32509,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLE
                                        HANDLE_EXCEPTION();
                                }
                                if (UNEXPECTED(ce == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                        if (IS_CV != IS_CONST) {
                                                zend_string_release(Z_STR(tmp));
                                        }
@@ -32532,12 +32546,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLE
        SAVE_OPLINE();
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -32605,12 +32619,12 @@ num_index_dim:
                }
                if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                        if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        } else {
                                Z_OBJ_HT_P(container)->unset_dimension(container, offset);
                        }
                } else if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                }
        } while (0);
 
@@ -32629,12 +32643,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLE
        SAVE_OPLINE();
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -32781,7 +32795,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_
        container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -32918,7 +32932,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV
        container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -33008,7 +33022,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZE
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
 
                HANDLE_EXCEPTION();
@@ -33043,7 +33057,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZE
                                zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var);
 
                                if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -33322,7 +33336,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
 
                HANDLE_EXCEPTION();
@@ -33357,7 +33371,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND
                                zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var);
 
                                if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
                                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                                        HANDLE_EXCEPTION();
                                }
@@ -33532,7 +33546,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -33559,7 +33573,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -33724,7 +33738,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER
        value_ptr = _get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets nor overloaded objects");
 
                HANDLE_EXCEPTION();
        }
@@ -33745,14 +33759,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER
 
        variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
        if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets nor overloaded objects");
                if (free_op2) {zval_ptr_dtor_nogc(free_op2);};
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR &&
            UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT) &&
            UNEXPECTED(!Z_ISREF_P(variable_ptr))) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot assign by reference to overloaded object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot assign by reference to overloaded object");
                if (free_op2) {zval_ptr_dtor_nogc(free_op2);};
 
                HANDLE_EXCEPTION();
@@ -33831,7 +33845,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(
                                        HANDLE_EXCEPTION();
                                }
                                if (UNEXPECTED(ce == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                        if (IS_CV != IS_CONST) {
                                                zend_string_release(Z_STR(tmp));
                                        }
@@ -34016,7 +34030,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
 
                HANDLE_EXCEPTION();
@@ -34051,7 +34065,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND
                                zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var);
 
                                if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
                                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                                        HANDLE_EXCEPTION();
                                }
@@ -34159,13 +34173,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -34191,7 +34205,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                        FREE_OP(free_op_data1);
 
@@ -34476,7 +34490,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -34503,7 +34517,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
 
                                        HANDLE_EXCEPTION();
                                }
@@ -34638,7 +34652,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HAN
        container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, NULL, IS_UNUSED);
@@ -34661,7 +34675,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HA
        container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, NULL, IS_UNUSED);
@@ -34684,14 +34698,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNU
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
         }
                container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
                if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -34703,7 +34717,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNU
 
        } else {
                if (IS_UNUSED == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
 
                        HANDLE_EXCEPTION();
@@ -34731,7 +34745,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HAND
        object_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -34780,7 +34794,7 @@ try_assign_dim_array:
                } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
                        if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) {
                                if (IS_UNUSED == IS_UNUSED) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "[] operator not supported for strings");
                                        FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                                        HANDLE_EXCEPTION();
@@ -34885,7 +34899,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUS
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var);
                if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -35062,7 +35076,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDL
                                        HANDLE_EXCEPTION();
                                }
                                if (UNEXPECTED(ce == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                        if (IS_CV != IS_CONST) {
                                                zend_string_release(Z_STR(tmp));
                                        }
@@ -35200,7 +35214,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(Z
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
 
                HANDLE_EXCEPTION();
@@ -35235,7 +35249,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(Z
                                zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var);
 
                                if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -35991,7 +36005,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -36000,7 +36014,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -36055,13 +36069,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -36087,7 +36101,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                        FREE_OP(free_op_data1);
 
@@ -36129,7 +36143,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_C
        var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -36386,7 +36400,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -36394,7 +36408,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -36467,7 +36481,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -36475,7 +36489,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -36557,7 +36571,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER
        container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var), IS_CV);
@@ -36580,7 +36594,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLE
        container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var), IS_CV);
@@ -36618,14 +36632,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
         }
                container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
                if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                        HANDLE_EXCEPTION();
                }
@@ -36637,7 +36651,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_
 
        } else {
                if (IS_CV == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
 
 
                        HANDLE_EXCEPTION();
@@ -36661,7 +36675,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HAN
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                HANDLE_EXCEPTION();
        }
@@ -36687,7 +36701,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER
        container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -36760,12 +36774,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER
 
        container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -36792,12 +36806,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLE
        container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -36823,7 +36837,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLE
        container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -36899,18 +36913,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CV_
                container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
                if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                        HANDLE_EXCEPTION();
                }
                if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
 
 
                        HANDLE_EXCEPTION();
                }
                if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                        HANDLE_EXCEPTION();
                }
@@ -36937,7 +36951,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HAN
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -36945,7 +36959,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HAN
        property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
 
                HANDLE_EXCEPTION();
        }
@@ -36970,7 +36984,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_HANDLER(
        object = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -36978,7 +36992,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_HANDLER(
        property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
 
                HANDLE_EXCEPTION();
        }
@@ -37005,7 +37019,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(
        object_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                HANDLE_EXCEPTION();
@@ -37054,7 +37068,7 @@ try_assign_dim_array:
                } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
                        if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) {
                                if (IS_CV == IS_UNUSED) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "[] operator not supported for strings");
                                        FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                                        HANDLE_EXCEPTION();
@@ -37139,7 +37153,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(
        value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op2.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets nor overloaded objects");
 
                HANDLE_EXCEPTION();
        }
@@ -37160,14 +37174,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(
 
        variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
        if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets nor overloaded objects");
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR &&
            UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT) &&
            UNEXPECTED(!Z_ISREF_P(variable_ptr))) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot assign by reference to overloaded object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot assign by reference to overloaded object");
 
 
                HANDLE_EXCEPTION();
@@ -37287,7 +37301,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
 
 
                        HANDLE_EXCEPTION();
@@ -37297,7 +37311,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
        object = _get_zval_ptr_cv_undef(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -37317,7 +37331,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
 
 
                                HANDLE_EXCEPTION();
@@ -37333,7 +37347,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
 
 
                        HANDLE_EXCEPTION();
@@ -37343,7 +37357,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
 
 
@@ -37454,7 +37468,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_H
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var);
                if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -37586,12 +37600,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(Z
        SAVE_OPLINE();
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -37659,12 +37673,12 @@ num_index_dim:
                }
                if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                        if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        } else {
                                Z_OBJ_HT_P(container)->unset_dimension(container, offset);
                        }
                } else if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                }
        } while (0);
 
@@ -37683,12 +37697,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(Z
        SAVE_OPLINE();
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
 
                HANDLE_EXCEPTION();
        }
@@ -37730,7 +37744,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_
        container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -37867,7 +37881,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV
        container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -37910,7 +37924,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_
 
        SAVE_OPLINE();
        if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot yield from finally in a force-closed generator");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield from finally in a force-closed generator");
 
 
                HANDLE_EXCEPTION();
@@ -37945,7 +37959,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_
                                zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var);
 
                                if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Cannot yield string offsets by reference");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot yield string offsets by reference");
 
                                        HANDLE_EXCEPTION();
                                }
@@ -38680,7 +38694,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
@@ -38689,7 +38703,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_obj_helper_SP
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
@@ -38744,13 +38758,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
        SAVE_OPLINE();
        container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
@@ -38776,7 +38790,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP
                var_ptr = Z_INDIRECT(rv);
 
                if (UNEXPECTED(var_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
                        zval_ptr_dtor_nogc(free_op2);
                        FREE_OP(free_op_data1);
 
@@ -38819,7 +38833,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_C
        var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use assign-op operators with overloaded objects nor string offsets");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -39077,7 +39091,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -39085,7 +39099,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_incdec_property_helper_SPE
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -39159,7 +39173,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -39167,7 +39181,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_incdec_property_helper_SP
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot increment/decrement overloaded objects nor string offsets");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -39250,7 +39264,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_TMPVAR_HAN
        container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2), (IS_TMP_VAR|IS_VAR));
@@ -39273,7 +39287,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_TMPVAR_HA
        container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                HANDLE_EXCEPTION();
        }
        zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2), (IS_TMP_VAR|IS_VAR));
@@ -39311,14 +39325,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP
 
        if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
         if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
-            zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+            zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
 
                        HANDLE_EXCEPTION();
         }
                container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
                if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                        HANDLE_EXCEPTION();
                }
@@ -39330,7 +39344,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP
 
        } else {
                if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use [] for reading");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use [] for reading");
                        zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
 
                        HANDLE_EXCEPTION();
@@ -39354,7 +39368,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_TMPVAR
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -39380,7 +39394,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMPVAR_HAN
        container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -39454,12 +39468,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMPVAR_HAN
 
        container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -39486,12 +39500,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_TMPVAR_HA
        container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -39517,7 +39531,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMPVAR_HA
        container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -39594,18 +39608,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_TMP
                container = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
                if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
                if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use temporary expression in write context");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use temporary expression in write context");
                        zval_ptr_dtor_nogc(free_op2);
 
                        HANDLE_EXCEPTION();
                }
                if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                        zval_ptr_dtor_nogc(free_op2);
                        HANDLE_EXCEPTION();
                }
@@ -39632,7 +39646,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMPVAR
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -39640,7 +39654,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMPVAR
        property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an object");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an object");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -39665,7 +39679,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_HAND
        object = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -39673,7 +39687,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_HAND
        property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -39700,7 +39714,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_HAND
        object_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
 
        if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot use string offset as an array");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use string offset as an array");
                FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
@@ -39749,7 +39763,7 @@ try_assign_dim_array:
                } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
                        if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) {
                                if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings");
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "[] operator not supported for strings");
                                        FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
 
                                        HANDLE_EXCEPTION();
@@ -39893,7 +39907,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
                        zval_ptr_dtor_nogc(free_op2);
 
                        HANDLE_EXCEPTION();
@@ -39903,7 +39917,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
        object = _get_zval_ptr_cv_undef(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -39923,7 +39937,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
                                zval_ptr_dtor_nogc(free_op2);
 
                                HANDLE_EXCEPTION();
@@ -39939,7 +39953,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
                        zval_ptr_dtor_nogc(free_op2);
 
                        HANDLE_EXCEPTION();
@@ -39949,7 +39963,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
                        zval_ptr_dtor_nogc(free_op2);
 
@@ -40061,7 +40075,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMPV
            UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
                expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var);
                if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot create references to/from string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot create references to/from string offsets");
                        zend_array_destroy(Z_ARRVAL_P(EX_VAR(opline->result.var)));
                        HANDLE_EXCEPTION();
                }
@@ -40193,12 +40207,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMPVAR_HANDL
        SAVE_OPLINE();
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -40266,12 +40280,12 @@ num_index_dim:
                }
                if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
                        if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot use object as array");
                        } else {
                                Z_OBJ_HT_P(container)->unset_dimension(container, offset);
                        }
                } else if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                }
        } while (0);
 
@@ -40291,12 +40305,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMPVAR_HANDL
        SAVE_OPLINE();
        container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var);
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
        if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Cannot unset string offsets");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Cannot unset string offsets");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -40339,7 +40353,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_
        container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -40476,7 +40490,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV
        container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var);
 
        if (IS_CV == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -40864,7 +40878,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND
        obj = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(obj) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                HANDLE_EXCEPTION();
        }
 
@@ -40883,7 +40897,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "__clone method called on non-object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "__clone method called on non-object");
                        zval_ptr_dtor_nogc(free_op1);
                        HANDLE_EXCEPTION();
                }
@@ -40894,9 +40908,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND
        clone_call =  Z_OBJ_HT_P(obj)->clone_obj;
        if (UNEXPECTED(clone_call == NULL)) {
                if (ce) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
                } else {
-                       zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Trying to clone an uncloneable object");
                }
                zval_ptr_dtor_nogc(free_op1);
                HANDLE_EXCEPTION();
@@ -40907,7 +40921,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (UNEXPECTED(ce != EG(scope))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
                                zval_ptr_dtor_nogc(free_op1);
                                HANDLE_EXCEPTION();
                        }
@@ -40915,7 +40929,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : "");
                                zval_ptr_dtor_nogc(free_op1);
                                HANDLE_EXCEPTION();
                        }
@@ -41775,7 +41789,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
                                        zval_ptr_dtor_nogc(free_op1);
                                        HANDLE_EXCEPTION();
                                }
@@ -41802,7 +41816,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
                                        zval_ptr_dtor_nogc(free_op1);
                                        HANDLE_EXCEPTION();
                                }
@@ -41970,7 +41984,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CONST
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -42175,7 +42189,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
@@ -42185,7 +42199,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
        object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -42205,7 +42219,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
 
                                zval_ptr_dtor_nogc(free_op1);
                                HANDLE_EXCEPTION();
@@ -42221,7 +42235,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
 
                        zval_ptr_dtor_nogc(free_op1);
                        HANDLE_EXCEPTION();
@@ -42231,7 +42245,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
 
                        zval_ptr_dtor_nogc(free_op1);
@@ -42389,7 +42403,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMPVAR_CONST_HA
                                        HANDLE_EXCEPTION();
                                }
                                if (UNEXPECTED(ce == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                        if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
                                                zend_string_release(Z_STR(tmp));
                                        }
@@ -42533,7 +42547,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -42670,7 +42684,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TM
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -42803,7 +42817,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
                                        zval_ptr_dtor_nogc(free_op1);
                                        HANDLE_EXCEPTION();
                                }
@@ -42830,7 +42844,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
                                        zval_ptr_dtor_nogc(free_op1);
                                        HANDLE_EXCEPTION();
                                }
@@ -43013,7 +43027,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMPVAR_VAR_HAND
                                        HANDLE_EXCEPTION();
                                }
                                if (UNEXPECTED(ce == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                        if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
                                                zend_string_release(Z_STR(tmp));
                                        }
@@ -43226,7 +43240,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
                                        zval_ptr_dtor_nogc(free_op1);
                                        HANDLE_EXCEPTION();
                                }
@@ -43253,7 +43267,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
 
                                /* check if static properties were destoyed */
                                if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
                                        zval_ptr_dtor_nogc(free_op1);
                                        HANDLE_EXCEPTION();
                                }
@@ -43436,7 +43450,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMPVAR_UNUSED_H
                                        HANDLE_EXCEPTION();
                                }
                                if (UNEXPECTED(ce == NULL)) {
-                                       zend_error(E_EXCEPTION | E_ERROR, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
+                                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
                                        if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
                                                zend_string_release(Z_STR(tmp));
                                        }
@@ -44212,7 +44226,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CV_HA
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -44372,7 +44386,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
 
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
@@ -44382,7 +44396,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
        object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -44402,7 +44416,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
 
                                zval_ptr_dtor_nogc(free_op1);
                                HANDLE_EXCEPTION();
@@ -44418,7 +44432,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
 
                        zval_ptr_dtor_nogc(free_op1);
                        HANDLE_EXCEPTION();
@@ -44428,7 +44442,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
 
                        zval_ptr_dtor_nogc(free_op1);
@@ -44542,7 +44556,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -44679,7 +44693,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TM
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
 
                HANDLE_EXCEPTION();
        }
@@ -45375,7 +45389,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_TMPVA
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -45536,7 +45550,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
                        if (UNEXPECTED(EG(exception) != NULL)) {
                                HANDLE_EXCEPTION();
                        }
-                       zend_error(E_EXCEPTION | E_ERROR, "Method name must be a string");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Method name must be a string");
                        zval_ptr_dtor_nogc(free_op2);
                        zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                        HANDLE_EXCEPTION();
@@ -45546,7 +45560,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
        object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(free_op2);
                HANDLE_EXCEPTION();
        }
@@ -45566,7 +45580,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
                                if (UNEXPECTED(EG(exception) != NULL)) {
                                        HANDLE_EXCEPTION();
                                }
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
                                zval_ptr_dtor_nogc(free_op2);
                                zval_ptr_dtor_nogc(free_op1);
                                HANDLE_EXCEPTION();
@@ -45582,7 +45596,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
            zend_object *orig_obj = obj;
 
                if (UNEXPECTED(obj->handlers->get_method == NULL)) {
-                       zend_error(E_EXCEPTION | E_ERROR, "Object does not support method calls");
+                       zend_throw_error(zend_ce_error, E_EXCEPTION, "Object does not support method calls");
                        zval_ptr_dtor_nogc(free_op2);
                        zval_ptr_dtor_nogc(free_op1);
                        HANDLE_EXCEPTION();
@@ -45592,7 +45606,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
                fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
                if (UNEXPECTED(fbc == NULL)) {
                        if (EXPECTED(!EG(exception))) {
-                               zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
+                               zend_throw_error(zend_ce_error, E_EXCEPTION, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
                        }
                        zval_ptr_dtor_nogc(free_op2);
                        zval_ptr_dtor_nogc(free_op1);
@@ -45707,7 +45721,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }
@@ -45844,7 +45858,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TM
        container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
        if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_OBJ_P(container) == NULL)) {
-               zend_error(E_EXCEPTION | E_ERROR, "Using $this when not in object context");
+               zend_throw_error(zend_ce_error, E_EXCEPTION, "Using $this when not in object context");
                zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
                HANDLE_EXCEPTION();
        }