static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces) /* {{{ */ { zval obj; zend_object *object; zval trace; zend_class_entry *base_ce; zend_string *filename; Z_OBJ(obj) = object = zend_objects_new(class_type); Z_OBJ_HT(obj) = &default_exception_handlers; object_properties_init(object, class_type); if (EG(current_execute_data)) { zend_fetch_debug_backtrace(&trace, skip_top_traces, 0, 0); } else { array_init(&trace); } Z_SET_REFCOUNT(trace, 0); base_ce = i_get_exception_base(&obj); if (EXPECTED(class_type != zend_ce_parse_error || !(filename = zend_get_compiled_filename()))) { zend_update_property_string(base_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename()); zend_update_property_long(base_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno()); } else { zend_update_property_str(base_ce, &obj, "file", sizeof("file")-1, filename); zend_update_property_long(base_ce, &obj, "line", sizeof("line")-1, zend_get_compiled_lineno()); } zend_update_property(base_ce, &obj, "trace", sizeof("trace")-1, &trace); return object; }
void psi_error_wrapper(struct psi_data *context, struct psi_token *t, int type, const char *msg, ...) { va_list argv; const char *fn = NULL; unsigned ln = 0; if (context) { if (context->flags & PSI_SILENT) { /* context->last_error may be an argument to print */ char error[sizeof(context->last_error)]; va_start(argv, msg); vslprintf(error, sizeof(error), msg, argv); va_end(argv); memcpy(context->last_error, error, sizeof(context->last_error)); return; } } if (t) { fn = t->file->val; ln = t->line; } else if (zend_is_executing()) { fn = zend_get_executed_filename(); ln = zend_get_executed_lineno(); } else if (zend_is_compiling()) { fn = zend_get_compiled_filename()->val; ln = zend_get_compiled_lineno(); } else { fn = "PSI module startup"; } va_start(argv, msg); psi_verror(type, fn, ln, msg, argv); va_end(argv); va_start(argv, msg); PSI_DEBUG_LOCK(context, PSI_DEBUG_PRINTV(context, msg, argv); PSI_DEBUG_PRINT(context, "\n"); );
static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces) /* {{{ */ { zval obj, tmp; zend_object *object; zval trace; zend_class_entry *base_ce; zend_string *filename; Z_OBJ(obj) = object = zend_objects_new(class_type); Z_OBJ_HT(obj) = &default_exception_handlers; object_properties_init(object, class_type); if (EG(current_execute_data)) { zend_fetch_debug_backtrace(&trace, skip_top_traces, 0, 0); } else { array_init(&trace); } Z_SET_REFCOUNT(trace, 0); base_ce = i_get_exception_base(&obj); if (EXPECTED((class_type != zend_ce_parse_error && class_type != zend_ce_compile_error) || !(filename = zend_get_compiled_filename()))) { ZVAL_STRING(&tmp, zend_get_executed_filename()); zend_update_property_ex(base_ce, &obj, ZSTR_KNOWN(ZEND_STR_FILE), &tmp); zval_ptr_dtor(&tmp); ZVAL_LONG(&tmp, zend_get_executed_lineno()); zend_update_property_ex(base_ce, &obj, ZSTR_KNOWN(ZEND_STR_LINE), &tmp); } else { ZVAL_STR(&tmp, filename); zend_update_property_ex(base_ce, &obj, ZSTR_KNOWN(ZEND_STR_FILE), &tmp); ZVAL_LONG(&tmp, zend_get_compiled_lineno()); zend_update_property_ex(base_ce, &obj, ZSTR_KNOWN(ZEND_STR_LINE), &tmp); } zend_update_property_ex(base_ce, &obj, ZSTR_KNOWN(ZEND_STR_TRACE), &trace); return object; }