2003-03-23 12:32:24 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Zend Engine |
|
|
|
|
+----------------------------------------------------------------------+
|
2019-01-30 17:23:29 +08:00
|
|
|
| Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
|
2003-03-23 12:32:24 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| This source file is subject to version 2.00 of the Zend license, |
|
2015-01-03 17:22:58 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-11 04:04:29 +08:00
|
|
|
| available through the world-wide-web at the following url: |
|
2003-03-23 12:32:24 +08:00
|
|
|
| http://www.zend.com/license/2_00.txt. |
|
|
|
|
| If you did not receive a copy of the Zend license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@zend.com so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
2018-11-01 23:20:07 +08:00
|
|
|
| Authors: Andi Gutmans <andi@php.net> |
|
2003-08-24 23:07:00 +08:00
|
|
|
| Marcus Boerger <helly@php.net> |
|
2004-02-12 18:38:14 +08:00
|
|
|
| Sterling Hughes <sterling@php.net> |
|
2018-11-01 23:20:07 +08:00
|
|
|
| Zeev Suraski <zeev@php.net> |
|
2003-03-23 12:32:24 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
2004-02-12 18:38:14 +08:00
|
|
|
#ifndef ZEND_EXCEPTIONS_H
|
|
|
|
#define ZEND_EXCEPTIONS_H
|
2003-03-23 12:32:24 +08:00
|
|
|
|
|
|
|
BEGIN_EXTERN_C()
|
|
|
|
|
2015-06-16 07:07:27 +08:00
|
|
|
extern ZEND_API zend_class_entry *zend_ce_throwable;
|
2015-07-03 22:45:03 +08:00
|
|
|
extern ZEND_API zend_class_entry *zend_ce_exception;
|
|
|
|
extern ZEND_API zend_class_entry *zend_ce_error_exception;
|
|
|
|
extern ZEND_API zend_class_entry *zend_ce_error;
|
2017-09-24 21:24:51 +08:00
|
|
|
extern ZEND_API zend_class_entry *zend_ce_compile_error;
|
2015-07-03 22:45:03 +08:00
|
|
|
extern ZEND_API zend_class_entry *zend_ce_parse_error;
|
|
|
|
extern ZEND_API zend_class_entry *zend_ce_type_error;
|
2016-08-31 03:09:26 +08:00
|
|
|
extern ZEND_API zend_class_entry *zend_ce_argument_count_error;
|
2019-09-05 04:39:02 +08:00
|
|
|
extern ZEND_API zend_class_entry *zend_ce_value_error;
|
2015-07-03 02:47:44 +08:00
|
|
|
extern ZEND_API zend_class_entry *zend_ce_arithmetic_error;
|
2015-07-02 07:54:08 +08:00
|
|
|
extern ZEND_API zend_class_entry *zend_ce_division_by_zero_error;
|
2020-04-10 04:36:37 +08:00
|
|
|
extern ZEND_API zend_class_entry *zend_ce_unhandled_match_error;
|
2015-06-16 07:07:27 +08:00
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_exception_set_previous(zend_object *exception, zend_object *add_previous);
|
|
|
|
ZEND_API void zend_exception_save(void);
|
|
|
|
ZEND_API void zend_exception_restore(void);
|
2008-07-14 05:42:49 +08:00
|
|
|
|
2020-08-06 00:45:07 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_throw_exception_internal(zend_object *exception);
|
2004-02-12 18:38:14 +08:00
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
void zend_register_default_exception(void);
|
2004-02-12 18:38:14 +08:00
|
|
|
|
2020-08-07 21:15:50 +08:00
|
|
|
ZEND_API zend_class_entry *zend_get_exception_base(zend_object *object);
|
2015-07-03 09:57:53 +08:00
|
|
|
|
2015-07-03 22:45:03 +08:00
|
|
|
/* Deprecated - Use zend_ce_exception directly instead */
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API zend_class_entry *zend_exception_get_default(void);
|
2015-07-03 09:57:53 +08:00
|
|
|
|
2015-07-03 22:45:03 +08:00
|
|
|
/* Deprecated - Use zend_ce_error_exception directly instead */
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API zend_class_entry *zend_get_error_exception(void);
|
2015-07-03 09:57:53 +08:00
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_register_default_classes(void);
|
2003-08-24 23:07:00 +08:00
|
|
|
|
2015-07-03 22:45:03 +08:00
|
|
|
/* exception_ce NULL, zend_ce_exception, zend_ce_error, or a derived class
|
2003-08-24 23:07:00 +08:00
|
|
|
* message NULL or the message of the exception */
|
2015-08-19 19:40:56 +08:00
|
|
|
ZEND_API ZEND_COLD zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code);
|
2016-06-21 21:00:37 +08:00
|
|
|
ZEND_API ZEND_COLD zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 3, 4);
|
2015-08-19 19:40:56 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_throw_exception_object(zval *exception);
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_clear_exception(void);
|
2003-08-24 23:07:00 +08:00
|
|
|
|
2020-05-29 16:33:22 +08:00
|
|
|
ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, zend_string *message, zend_long code, int severity);
|
2004-07-16 06:21:36 +08:00
|
|
|
|
2020-08-06 00:45:07 +08:00
|
|
|
extern ZEND_API void (*zend_throw_exception_hook)(zend_object *ex);
|
2004-04-13 23:19:21 +08:00
|
|
|
|
2009-01-02 21:14:49 +08:00
|
|
|
/* show an exception using zend_error(severity,...), severity should be E_ERROR */
|
2020-08-28 21:41:27 +08:00
|
|
|
ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *exception, int severity);
|
2021-05-28 16:19:23 +08:00
|
|
|
ZEND_NORETURN void zend_exception_uncaught_error(const char *prefix, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
|
2021-05-18 17:43:37 +08:00
|
|
|
ZEND_API zend_string *zend_trace_to_string(HashTable *trace, bool include_main);
|
2020-03-06 21:57:55 +08:00
|
|
|
|
2021-06-29 04:23:34 +08:00
|
|
|
ZEND_API ZEND_COLD zend_object *zend_create_unwind_exit(void);
|
|
|
|
ZEND_API ZEND_COLD zend_object *zend_create_graceful_exit(void);
|
2020-03-06 21:57:55 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_throw_unwind_exit(void);
|
2021-04-27 00:07:06 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_throw_graceful_exit(void);
|
|
|
|
ZEND_API bool zend_is_unwind_exit(const zend_object *ex);
|
|
|
|
ZEND_API bool zend_is_graceful_exit(const zend_object *ex);
|
2003-08-24 23:07:00 +08:00
|
|
|
|
2016-12-12 16:19:04 +08:00
|
|
|
#include "zend_globals.h"
|
|
|
|
|
2016-12-12 15:55:32 +08:00
|
|
|
static zend_always_inline void zend_rethrow_exception(zend_execute_data *execute_data)
|
|
|
|
{
|
|
|
|
if (EX(opline)->opcode != ZEND_HANDLE_EXCEPTION) {
|
|
|
|
EG(opline_before_exception) = EX(opline);
|
|
|
|
EX(opline) = EG(exception_op);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-23 12:32:24 +08:00
|
|
|
END_EXTERN_C()
|
|
|
|
|
|
|
|
#endif
|