75 ?
"%s %s cannot implement interface %s, extend Exception or Error instead"
76 :
"%s %s cannot implement interface %s",
77 zend_get_object_type_uc(class_type),
92 return i_get_exception_base(
object);
98 zval *previous, *ancestor, *
ex;
112 &&
"Previous exception must implement Throwable");
128 base_ce = i_get_exception_base(
Z_OBJ_P(
ex));
143 if (
EG(prev_exception)) {
155 if (
EG(prev_exception)) {
161 EG(prev_exception) =
NULL;
177 if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
181 DTRACE_EXCEPTION_THROWN(
NULL);
200 if (!
EG(current_execute_data)) {
225 if (is_handle_exception_set()) {
229 EG(opline_before_exception) =
EG(current_execute_data)->opline;
230 EG(current_execute_data)->opline =
EG(exception_op);
237 if (
EG(prev_exception)) {
239 EG(prev_exception) =
NULL;
248 if (
EG(current_execute_data)) {
249 EG(current_execute_data)->opline =
EG(opline_before_exception);
252 EG(opline_before_exception) =
NULL;
267 if (
EG(current_execute_data)) {
276 base_ce = i_get_exception_base(
object);
314 base_ce = i_get_exception_base(
Z_OBJ_P(
object));
337#define CHECK_EXC_TYPE(id, type) \
338 pvalue = zend_read_property_ex(i_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_KNOWN(id), 1, &value); \
339 if (Z_TYPE_P(pvalue) != IS_NULL && Z_TYPE_P(pvalue) != type) { \
340 zend_unset_property(i_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_VAL(ZSTR_KNOWN(id)), ZSTR_LEN(ZSTR_KNOWN(id))); \
360 bool lineno_is_null = 1;
393 if (!lineno_is_null) {
396 }
else if (filename) {
403#define GET_PROPERTY(object, id) \
404 zend_read_property_ex(i_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_KNOWN(id), 0, &rv)
405#define GET_PROPERTY_SILENT(object, id) \
406 zend_read_property_ex(i_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_KNOWN(id), 1, &rv)
483#define TRACE_APPEND_KEY(key) do { \
484 tmp = zend_hash_find(ht, key); \
486 if (Z_TYPE_P(tmp) != IS_STRING) { \
487 zend_error(E_WARNING, "Value for %s is not a string", \
489 smart_str_appends(str, "[unknown]"); \
491 smart_str_appends(str, Z_STRVAL_P(tmp)); \
507 smart_str_appends(str,
", ");
511 smart_str_appends(str,
"Resource id #");
513 smart_str_appends(str,
", ");
516 smart_str_appends(str,
"Array, ");
520 smart_str_appends(str,
"Object(");
521 smart_str_appends(str,
ZSTR_VAL(class_name));
522 smart_str_appends(str,
"), ");
535 smart_str_appendc(str,
'#');
536 smart_str_append_long(str, num);
537 smart_str_appendc(str,
' ');
543 smart_str_appends(str,
"[unknown file]: ");
555 smart_str_appendc(str,
'(');
556 smart_str_append_long(str,
line);
557 smart_str_appends(str,
"): ");
560 smart_str_appends(str,
"[internal function]: ");
565 smart_str_appendc(str,
'(');
575 smart_str_append(str,
name);
576 smart_str_appends(str,
": ");
578 _build_trace_args(
arg, str);
588 smart_str_appends(str,
")\n");
608 smart_str_appendc(&str,
'#');
609 smart_str_append_long(&str, num);
610 smart_str_appends(&str,
" {main}");
671 fci.
size =
sizeof(fci);
689 message = real_message;
693 ? zend_string_copy(
Z_STR(trace))
704 tmp_trace,
ZSTR_LEN(prev_str) ?
"\n\nNext " :
"", prev_str);
708 tmp_trace,
ZSTR_LEN(prev_str) ?
"\n\nNext " :
"", prev_str);
761 default_exception_handlers.clone_obj =
NULL;
828 &&
"Exceptions must implement Throwable");
850 zend_object *
ex = zend_throw_exception_zstr(exception_ce, msg_str, code);
852 zend_string_release(msg_str);
864 va_start(
arg, format);
875 zend_object *obj = zend_throw_exception_zstr(exception_ce, message, code);
885static void zend_error_va(
int type,
zend_string *
file, uint32_t lineno,
const char *format, ...)
888 va_start(
args, format);
890 zend_observer_error_notify(
type,
file, lineno, message);
892 zend_string_release(message);
905 ce_exception =
ex->ce;
923 zend_call_known_instance_method_with_0_params(
ex->ce->__tostring,
ex, &tmp);
944 "Uncaught %s in exception handling during call to %s::__toString()",
958 "Uncaught %S\n thrown", str);
962 }
else if (ce_exception == &zend_ce_unwind_exit || ce_exception == &zend_ce_graceful_exit) {
976 va_start(va, format);
985 zend_string *exception_str = zval_get_string(&exception_zv);
1022 EG(opline_before_exception) =
EG(current_execute_data)->opline;
1023 EG(current_execute_data)->opline =
EG(exception_op);
1030 EG(opline_before_exception) =
EG(current_execute_data)->opline;
1031 EG(current_execute_data)->opline =
EG(exception_op);
1036 return ex->ce == &zend_ce_unwind_exit;
1041 return ex->ce == &zend_ce_graceful_exit;
file(string $filename, int $flags=0, $context=null)
strstr(string $haystack, string $needle, bool $before_needle=false)
zend_object *(* create_object)(zend_class_entry *class_type)
zend_class_entry * parent
const zend_object_handlers * default_object_handlers
ZEND_API zend_string * zend_vstrpprintf(size_t max_len, const char *format, va_list ap)
ZEND_API void(* zend_error_cb)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message)
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format,...)
ZEND_API zend_string * zend_strpprintf_unchecked(size_t max_len, const char *format,...)
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
ZEND_API ZEND_COLD void zend_error(int type, const char *format,...)
ZEND_API ZEND_COLD void zend_user_exception_handler(void)
ZEND_API size_t zend_vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap)
#define DEBUG_BACKTRACE_IGNORE_ARGS
ZEND_API zval * zend_read_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, bool silent, zval *rv)
ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *class_type)
ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec,...)
ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type)
ZEND_API void zend_update_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, zval *value)
#define ZEND_PARSE_PARAMETERS_NONE()
#define ZVAL_STRING(z, s)
#define INIT_CLASS_ENTRY(class_container, class_name, functions)
#define RETURN_NEW_STR(s)
struct _zend_fcall_info zend_fcall_info
#define ZEND_METHOD(classname, name)
ZEND_API zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache)
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit)
zend_string_release_ex(func->internal_function.function_name, 0)
ZEND_API int zend_get_compiled_lineno(void)
ZEND_API zend_string * zend_get_compiled_filename(void)
#define ZEND_USER_CODE(type)
ZEND_API zend_class_entry * zend_ce_arithmetic_error
ZEND_API ZEND_COLD zend_object * zend_throw_error_exception(zend_class_entry *exception_ce, zend_string *message, zend_long code, int severity)
ZEND_API ZEND_COLD void zend_throw_exception_internal(zend_object *exception)
void zend_exception_restore(void)
ZEND_API zend_class_entry * zend_exception_get_default(void)
ZEND_API bool zend_is_unwind_exit(const zend_object *ex)
ZEND_API zend_string * zend_trace_to_string(HashTable *trace, bool include_main)
void zend_register_default_exception(void)
ZEND_API zend_class_entry * zend_ce_exception
ZEND_API ZEND_COLD void zend_throw_exception_object(zval *exception)
ZEND_API zend_class_entry * zend_ce_value_error
void zend_exception_save(void)
ZEND_API zend_class_entry * zend_ce_type_error
ZEND_API zend_class_entry * zend_ce_error_exception
ZEND_API zend_class_entry * zend_ce_compile_error
ZEND_API ZEND_COLD zend_object * zend_create_unwind_exit(void)
ZEND_API zend_class_entry * zend_ce_unhandled_match_error
#define GET_PROPERTY(object, id)
#define GET_PROPERTY_SILENT(object, id)
ZEND_API bool zend_is_graceful_exit(const zend_object *ex)
ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severity)
ZEND_API ZEND_COLD zend_object * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code)
#define TRACE_APPEND_KEY(key)
#define CHECK_EXC_TYPE(id, type)
ZEND_API ZEND_COLD void zend_throw_graceful_exit(void)
ZEND_API ZEND_COLD zend_object * zend_create_graceful_exit(void)
ZEND_API void(* zend_throw_exception_hook)(zend_object *ex)
ZEND_API zend_class_entry * zend_ce_division_by_zero_error
ZEND_NORETURN void zend_exception_uncaught_error(const char *format,...)
ZEND_API ZEND_COLD void zend_throw_unwind_exit(void)
ZEND_API zend_class_entry * zend_ce_request_parse_body_exception
ZEND_API zend_class_entry * zend_ce_parse_error
ZEND_API zend_class_entry * zend_ce_argument_count_error
ZEND_API void zend_clear_exception(void)
ZEND_API ZEND_COLD zend_object * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format,...)
ZEND_API zend_class_entry * zend_ce_throwable
ZEND_API zend_class_entry * zend_get_error_exception(void)
void zend_exception_set_previous(zend_object *exception, zend_object *add_previous)
ZEND_API zend_class_entry * zend_get_exception_base(zend_object *object)
ZEND_API zend_class_entry * zend_ce_error
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
ZEND_API uint32_t zend_get_executed_lineno(void)
ZEND_API const char * zend_get_executed_filename(void)
ZEND_API zval *ZEND_FASTCALL zend_hash_find_known_hash(const HashTable *ht, const zend_string *key)
#define ZEND_HASH_FOREACH_NUM_KEY_VAL(ht, _h, _val)
#define ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val)
#define ZEND_HASH_FOREACH_END()
ZEND_API zend_class_entry * zend_ce_stringable
struct _zend_string zend_string
ZEND_API const zend_object_handlers std_object_handlers
ZEND_API zend_object *ZEND_FASTCALL zend_objects_new(zend_class_entry *ce)
#define EXPECTED(condition)
#define zend_always_inline
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
ZEND_API zend_result ZEND_FASTCALL smart_str_append_zval(smart_str *dest, const zval *value, size_t truncate)
#define ZSTR_INIT_LITERAL(s, persistent)
#define zend_string_equals_literal(str, literal)
#define ZSTR_EMPTY_ALLOC()
#define Z_OBJ_HANDLER_P(zv_p, hf)
#define Z_ARRVAL_P(zval_p)
#define ZVAL_STR_COPY(z, s)
struct _zend_array HashTable
#define ZVAL_COPY_DEREF(z, v)
#define Z_UNPROTECT_RECURSION_P(zv)
#define Z_OBJCE_P(zval_p)
#define Z_RES_HANDLE_P(zval_p)
#define ZVAL_OBJ_COPY(z, o)
#define Z_PROTECT_RECURSION_P(zv)
ZEND_RESULT_CODE zend_result
struct _zend_object_handlers zend_object_handlers
#define Z_SET_REFCOUNT(z, rc)
struct _zend_execute_data zend_execute_data
#define Z_IS_RECURSIVE_P(zv)
ZEND_API void zval_ptr_dtor(zval *zval_ptr)
#define ZEND_HANDLE_EXCEPTION