summaryrefslogtreecommitdiff
path: root/Zend/zend_exceptions.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_exceptions.c')
-rw-r--r--Zend/zend_exceptions.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 342988740b..eab7f65881 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -93,9 +93,9 @@ static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_t
trace->refcount = 0;
zend_fetch_debug_backtrace(trace, skip_top_traces, 0 TSRMLS_CC);
- zend_update_property_rt_string(U_CLASS_ENTRY(default_exception_ce), &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
- zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
- zend_update_property(U_CLASS_ENTRY(default_exception_ce), &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC);
+ zend_update_property_rt_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
+ zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC);
return obj.value.obj;
}
@@ -139,22 +139,22 @@ ZEND_METHOD(exception, __construct)
if (message) {
if (message_type == IS_UNICODE) {
- zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
+ zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
} else if (UG(unicode)) {
UErrorCode status = U_ZERO_ERROR;
UChar *u_str;
int32_t u_len;
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status);
- zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC);
+ zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC);
efree(u_str);
} else {
- zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
+ zend_update_property_stringl(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
}
}
if (code) {
- zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "code", sizeof("code")-1, code TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
}
}
/* }}} */
@@ -178,36 +178,36 @@ ZEND_METHOD(error_exception, __construct)
if (message) {
if (message_type == IS_UNICODE) {
- zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
+ zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
} else if (UG(unicode)) {
UErrorCode status = U_ZERO_ERROR;
UChar *u_str;
int32_t u_len;
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status);
- zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC);
+ zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC);
efree(u_str);
} else {
- zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
+ zend_update_property_stringl(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
}
}
if (code) {
- zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "code", sizeof("code")-1, code TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
}
- zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "severity", sizeof("severity")-1, severity TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC);
if (argc >= 4) {
if (file_type == IS_UNICODE) {
- zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC);
+ zend_update_property_unicodel(default_exception_ce, object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC);
} else {
- zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC);
+ zend_update_property_stringl(default_exception_ce, object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC);
}
if (argc < 5) {
lineno = 0; /* invalidate lineno */
}
- zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "line", sizeof("line")-1, lineno TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC);
}
}
/* }}} */
@@ -221,7 +221,7 @@ static void _default_exception_get_entry(zval *object, char *name, int name_len,
{
zval *value;
- value = zend_read_property(U_CLASS_ENTRY(default_exception_ce), object, name, name_len, 0 TSRMLS_CC);
+ value = zend_read_property(default_exception_ce, object, name, name_len, 0 TSRMLS_CC);
*return_value = *value;
zval_copy_ctor(return_value);
@@ -524,7 +524,7 @@ ZEND_METHOD(exception, getTraceAsString)
char *res = estrdup(""), **str = &res, *s_tmp;
int res_len = 0, *len = &res_len, num = 0;
- trace = zend_read_property(U_CLASS_ENTRY(default_exception_ce), getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
+ trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
zend_hash_apply_with_arguments(Z_ARRVAL_P(trace), (apply_func_args_t)_build_trace_string, 3, str, len, &num);
s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1);
@@ -596,7 +596,7 @@ ZEND_METHOD(exception, __toString)
/* We store the result in the private property string so we can access
* the result in uncaught exception handlers without memleaks. */
- zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), getThis(), "string", sizeof("string")-1, str TSRMLS_CC);
+ zend_update_property_string(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC);
if (trace) {
zval_ptr_dtor(&trace);
@@ -678,12 +678,12 @@ void zend_register_default_exception(TSRMLS_D)
ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D)
{
- return U_CLASS_ENTRY(default_exception_ce);
+ return default_exception_ce;
}
ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D)
{
- return U_CLASS_ENTRY(error_exception_ce);
+ return error_exception_ce;
}
@@ -693,21 +693,21 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *messa
MAKE_STD_ZVAL(ex);
if (exception_ce) {
- if (!instanceof_function(exception_ce, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) {
+ if (!instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) {
zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class");
- exception_ce = U_CLASS_ENTRY(default_exception_ce);
+ exception_ce = default_exception_ce;
}
} else {
- exception_ce = U_CLASS_ENTRY(default_exception_ce);
+ exception_ce = default_exception_ce;
}
object_init_ex(ex, exception_ce);
if (message) {
- zend_update_property_rt_string(U_CLASS_ENTRY(default_exception_ce), ex, "message", sizeof("message")-1, message TSRMLS_CC);
+ zend_update_property_rt_string(default_exception_ce, ex, "message", sizeof("message")-1, message TSRMLS_CC);
}
if (code) {
- zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), ex, "code", sizeof("code")-1, code TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, ex, "code", sizeof("code")-1, code TSRMLS_CC);
}
zend_throw_exception_internal(ex TSRMLS_CC);
@@ -733,7 +733,7 @@ ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long cod
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(U_CLASS_ENTRY(default_exception_ce), ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
return ex;
}
@@ -750,7 +750,7 @@ static void zend_error_va(int type, const char *file, uint lineno, const char *f
ZEND_API void zend_exception_error(zval *exception TSRMLS_DC)
{
zend_class_entry *ce_exception = Z_OBJCE_P(exception);
- if (instanceof_function(ce_exception, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) {
+ if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
zval *str, *file, *line;
EG(exception) = NULL;
@@ -760,16 +760,16 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC)
if (Z_TYPE_P(str) != IS_STRING) {
zend_error(E_WARNING, "%v::__toString() must return a string", ce_exception->name);
} else {
- zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC);
+ zend_update_property_string(default_exception_ce, exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC);
}
}
zval_ptr_dtor(&str);
if (EG(exception)) {
/* do the best we can to inform about the inner exception */
- if (instanceof_function(ce_exception, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) {
- file = zend_read_property(U_CLASS_ENTRY(default_exception_ce), EG(exception), "file", sizeof("file")-1, 1 TSRMLS_CC);
- line = zend_read_property(U_CLASS_ENTRY(default_exception_ce), EG(exception), "line", sizeof("line")-1, 1 TSRMLS_CC);
+ if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
+ file = zend_read_property(default_exception_ce, EG(exception), "file", sizeof("file")-1, 1 TSRMLS_CC);
+ line = zend_read_property(default_exception_ce, EG(exception), "line", sizeof("line")-1, 1 TSRMLS_CC);
} else {
file = NULL;
line = NULL;
@@ -777,9 +777,9 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC)
zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, "Uncaught %v in exception handling during call to %v::__tostring()", Z_OBJCE_P(EG(exception))->name, ce_exception->name);
}
- str = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "string", sizeof("string")-1, 1 TSRMLS_CC);
- file = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "file", sizeof("file")-1, 1 TSRMLS_CC);
- line = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "line", sizeof("line")-1, 1 TSRMLS_CC);
+ str = zend_read_property(default_exception_ce, exception, "string", sizeof("string")-1, 1 TSRMLS_CC);
+ file = zend_read_property(default_exception_ce, exception, "file", sizeof("file")-1, 1 TSRMLS_CC);
+ line = zend_read_property(default_exception_ce, exception, "line", sizeof("line")-1, 1 TSRMLS_CC);
if (Z_TYPE_P(file) == IS_UNICODE) {
zval copy;
@@ -806,7 +806,7 @@ ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC)
exception_ce = Z_OBJCE_P(exception);
- if (!exception_ce || !instanceof_function(exception_ce, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) {
+ if (!exception_ce || !instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) {
zend_error(E_ERROR, "Exceptions must be valid objects derived from the Exception base class");
}
zend_throw_exception_internal(exception TSRMLS_CC);