static zend_object_handlers default_exception_handlers;
ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
-
-void zend_throw_exception_internal(zval *exception TSRMLS_DC)
+void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
{
if (exception != NULL) {
if (EG(exception)) {
EG(opline_before_exception) = EG(current_execute_data)->opline;
EG(current_execute_data)->opline = &EG(active_op_array)->opcodes[EG(active_op_array)->last-1-1];
}
+/* }}} */
-
-
-
-ZEND_API void zend_clear_exception(TSRMLS_D)
+ZEND_API void zend_clear_exception(TSRMLS_D) /* {{{ */
{
if (!EG(exception)) {
return;
EG(opline_before_exception) = NULL;
#endif
}
+/* }}} */
-static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC)
+static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) /* {{{ */
{
zval tmp, obj;
zend_object *object;
return Z_OBJVAL(obj);
}
+/* }}} */
-static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC)
+static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
return zend_default_exception_new_ex(class_type, 0 TSRMLS_CC);
}
+/* }}} */
-static zend_object_value zend_error_exception_new(zend_class_entry *class_type TSRMLS_DC)
+static zend_object_value zend_error_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
return zend_default_exception_new_ex(class_type, 2 TSRMLS_CC);
}
-
+/* }}} */
/* {{{ proto Exception Exception::__clone()
Clone the exception object */
}
/* }}} */
-
/* {{{ proto Exception::__construct(string message, int code)
Exception constructor */
ZEND_METHOD(exception, __construct)
}
/* }}} */
-
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno]])
ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
ZEND_WRONG_PARAM_COUNT(); \
}
-static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC)
+static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */
{
zval *value;
zval_copy_ctor(return_value);
INIT_PZVAL(return_value);
}
-
+/* }}} */
/* {{{ proto string Exception::getFile()
Get the file in which the exception occurred */
}
/* }}} */
-
/* {{{ proto int Exception::getLine()
Get the line in which the exception occurred */
ZEND_METHOD(exception, getLine)
}
/* }}} */
-
/* {{{ proto string Exception::getMessage()
Get the exception message */
ZEND_METHOD(exception, getMessage)
}
/* }}} */
-
/* {{{ proto int Exception::getCode()
Get the exception code */
ZEND_METHOD(exception, getCode)
}
/* }}} */
-
/* {{{ proto array Exception::getTrace()
Get the stack trace for the location in which the exception occurred */
ZEND_METHOD(exception, getTrace)
}
/* }}} */
-
/* {{{ proto int ErrorException::getSeverity()
Get the exception severity */
ZEND_METHOD(error_exception, getSeverity)
}
/* }}} */
-/* {{{ ZEND_METHOD(exception, gettraceasstring) */
+/* {{{ gettraceasstring() macros */
#define TRACE_APPEND_CHR(chr) \
*str = (char*)erealloc(*str, *len + 1 + 1); \
(*str)[(*len)++] = chr
TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); \
}
-static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_key *hash_key)
+/* }}} */
+
+static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
char **str;
int *len;
}
return ZEND_HASH_APPLY_KEEP;
}
+/* }}} */
-static int _build_trace_string(zval **frame, int num_args, va_list args, zend_hash_key *hash_key)
+static int _build_trace_string(zval **frame, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
char *s_tmp, **str;
int *len, *num;
TRACE_APPEND_STR(")\n");
return ZEND_HASH_APPLY_KEEP;
}
-
+/* }}} */
/* {{{ proto string Exception::getTraceAsString()
Obtain the backtrace for the exception as a string (instead of an array) */
}
/* }}} */
-int zend_spprintf(char **message, int max_len, char *format, ...)
+int zend_spprintf(char **message, int max_len, char *format, ...) /* {{{ */
{
va_list arg;
int len;
va_end(arg);
return len;
}
-
+/* }}} */
/* {{{ proto string Exception::__toString()
Obtain the string representation of the Exception object */
}
/* }}} */
+/* {{{ internal structs */
/* All functions that may be used in uncaught exception handlers must be final
* and must not throw exceptions. Otherwise we would need a facility to handle
* such exceptions in that handler.
ZEND_ME(error_exception, getSeverity, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
{NULL, NULL, NULL}
};
+/* }}} */
-void zend_register_default_exception(TSRMLS_D)
+void zend_register_default_exception(TSRMLS_D) /* {{{ */
{
zend_class_entry ce;
error_exception_ce->create_object = zend_error_exception_new;
zend_declare_property_long(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC);
}
+/* }}} */
-ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D)
+ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D) /* {{{ */
{
return default_exception_ce;
}
+/* }}} */
-ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D)
+ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */
{
return error_exception_ce;
}
+/* }}} */
-
-ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC)
+ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC) /* {{{ */
{
zval *ex;
zend_throw_exception_internal(ex TSRMLS_CC);
return ex;
}
+/* }}} */
-
-ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...)
+ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...) /* {{{ */
{
va_list arg;
char *message;
efree(message);
return zexception;
}
+/* }}} */
-
-ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC)
+ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC) /* {{{ */
{
zval *ex = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
return ex;
}
+/* }}} */
-static void zend_error_va(int type, const char *file, uint lineno, const char *format, ...)
+static void zend_error_va(int type, const char *file, uint lineno, const char *format, ...) /* {{{ */
{
va_list args;
zend_error_cb(type, file, lineno, format, args);
va_end(args);
}
+/* }}} */
/* This function doesn't return as it calls E_ERROR */
-ZEND_API void zend_exception_error(zval *exception TSRMLS_DC)
+ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce_exception = Z_OBJCE_P(exception);
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
zend_error(E_ERROR, "Uncaught exception '%s'", ce_exception->name);
}
}
+/* }}} */
-
-ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC)
+ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC) /* {{{ */
{
zend_class_entry *exception_ce;
}
zend_throw_exception_internal(exception TSRMLS_CC);
}
+/* }}} */
/*
* Local variables: