summaryrefslogtreecommitdiff
path: root/Zend/zend_exceptions.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-02-10 10:04:30 +0400
committerDmitry Stogov <dmitry@zend.com>2014-02-10 10:04:30 +0400
commitf4cfaf36e23ca47da3e352e1c60909104c059647 (patch)
tree0db3e2a323b12c5bbf1a958c857f92eb58c240d1 /Zend/zend_exceptions.c
parent89a9acea1f9d821a9805b3857bf4febbba08690d (diff)
downloadphp-git-f4cfaf36e23ca47da3e352e1c60909104c059647.tar.gz
Use better data structures (incomplete)
Diffstat (limited to 'Zend/zend_exceptions.c')
-rw-r--r--Zend/zend_exceptions.c237
1 files changed, 125 insertions, 112 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index e973a67a92..938f885d0b 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -34,26 +34,29 @@ static zend_class_entry *error_exception_ce;
static zend_object_handlers default_exception_handlers;
ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
-void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)
+void zend_exception_set_previous(zend_object *exception, zend_object *add_previous TSRMLS_DC)
{
- zval *previous;
+ zval tmp, *previous, zv, *pzv;
if (exception == add_previous || !add_previous || !exception) {
return;
}
- if (Z_TYPE_P(add_previous) != IS_OBJECT && !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
+ ZVAL_OBJ(&tmp, add_previous);
+ if (!instanceof_function(Z_OBJCE(tmp), default_exception_ce TSRMLS_CC)) {
zend_error(E_ERROR, "Cannot set non exception as previous exception");
return;
}
- while (exception && exception != add_previous && Z_OBJ_HANDLE_P(exception) != Z_OBJ_HANDLE_P(add_previous)) {
- previous = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
+ ZVAL_OBJ(&zv, exception);
+ pzv = &zv;
+ do {
+ previous = zend_read_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
if (Z_TYPE_P(previous) == IS_NULL) {
- zend_update_property(default_exception_ce, exception, "previous", sizeof("previous")-1, add_previous TSRMLS_CC);
- Z_DELREF_P(add_previous);
+ zend_update_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, &tmp TSRMLS_CC);
+ add_previous->gc.refcount--;
return;
}
- exception = previous;
- }
+ pzv = previous;
+ } while (pzv && Z_OBJ_P(pzv) != add_previous);
}
void zend_exception_save(TSRMLS_D) /* {{{ */
@@ -98,9 +101,9 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
#endif /* HAVE_DTRACE */
if (exception != NULL) {
- zval *previous = EG(exception);
- zend_exception_set_previous(exception, EG(exception) TSRMLS_CC);
- EG(exception) = exception;
+ zend_object *previous = EG(exception);
+ zend_exception_set_previous(Z_OBJ_P(exception), EG(exception) TSRMLS_CC);
+ EG(exception) = Z_OBJ_P(exception);
if (previous) {
return;
}
@@ -129,13 +132,14 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
ZEND_API void zend_clear_exception(TSRMLS_D) /* {{{ */
{
if (EG(prev_exception)) {
- zval_ptr_dtor(&EG(prev_exception));
+
+//??? zval_ptr_dtor(&EG(prev_exception));
EG(prev_exception) = NULL;
}
if (!EG(exception)) {
return;
}
- zval_ptr_dtor(&EG(exception));
+//??? zval_ptr_dtor(&EG(exception));
EG(exception) = NULL;
EG(current_execute_data)->opline = EG(opline_before_exception);
#if ZEND_DEBUG
@@ -144,37 +148,34 @@ ZEND_API void zend_clear_exception(TSRMLS_D) /* {{{ */
}
/* }}} */
-static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) /* {{{ */
+static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) /* {{{ */
{
zval obj;
zend_object *object;
- zval *trace;
+ zval trace;
- Z_OBJVAL(obj) = zend_objects_new(&object, class_type TSRMLS_CC);
+ Z_OBJ(obj) = object = zend_objects_new(class_type TSRMLS_CC);
Z_OBJ_HT(obj) = &default_exception_handlers;
object_properties_init(object, class_type);
- ALLOC_ZVAL(trace);
- Z_UNSET_ISREF_P(trace);
- Z_SET_REFCOUNT_P(trace, 0);
- zend_fetch_debug_backtrace(trace, skip_top_traces, 0, 0 TSRMLS_CC);
+ zend_fetch_debug_backtrace(&trace, skip_top_traces, 0, 0 TSRMLS_CC);
zend_update_property_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);
+ zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, &trace TSRMLS_CC);
- return Z_OBJVAL(obj);
+ return object;
}
/* }}} */
-static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
+static zend_object *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 *zend_error_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
return zend_default_exception_new_ex(class_type, 2 TSRMLS_CC);
}
@@ -268,9 +269,8 @@ static void _default_exception_get_entry(zval *object, char *name, int name_len,
value = zend_read_property(default_exception_ce, object, name, name_len, 0 TSRMLS_CC);
- *return_value = *value;
- zval_copy_ctor(return_value);
- INIT_PZVAL(return_value);
+ ZVAL_DUP(return_value, value);
+//??? INIT_PZVAL(return_value);
}
/* }}} */
@@ -350,19 +350,21 @@ ZEND_METHOD(error_exception, getSeverity)
#define TRACE_APPEND_STR(val) \
TRACE_APPEND_STRL(val, sizeof(val)-1)
-#define TRACE_APPEND_KEY(key) \
- if (zend_hash_find(ht, key, sizeof(key), (void**)&tmp) == SUCCESS) { \
- if (Z_TYPE_PP(tmp) != IS_STRING) { \
- zend_error(E_WARNING, "Value for %s is no string", key); \
- TRACE_APPEND_STR("[unknown]"); \
- } else { \
- TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); \
- } \
- }
+#define TRACE_APPEND_KEY(key) do { \
+ tmp = zend_hash_str_find(ht, key, sizeof(key)-1); \
+ if (tmp) { \
+ if (Z_TYPE_P(tmp) != IS_STRING) { \
+ zend_error(E_WARNING, "Value for %s is no string", key); \
+ TRACE_APPEND_STR("[unknown]"); \
+ } else { \
+ TRACE_APPEND_STRL(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); \
+ } \
+ } \
+ } while (0)
/* }}} */
-static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
+static int _build_trace_args(zval *arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
char **str;
int *len;
@@ -376,20 +378,20 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
* but that could cause some E_NOTICE and also damn long lines.
*/
- switch (Z_TYPE_PP(arg)) {
+ switch (Z_TYPE_P(arg)) {
case IS_NULL:
TRACE_APPEND_STR("NULL, ");
break;
case IS_STRING: {
int l_added;
TRACE_APPEND_CHR('\'');
- if (Z_STRLEN_PP(arg) > 15) {
- TRACE_APPEND_STRL(Z_STRVAL_PP(arg), 15);
+ if (Z_STRLEN_P(arg) > 15) {
+ TRACE_APPEND_STRL(Z_STRVAL_P(arg), 15);
TRACE_APPEND_STR("...', ");
l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */
} else {
- l_added = Z_STRLEN_PP(arg);
- TRACE_APPEND_STRL(Z_STRVAL_PP(arg), l_added);
+ l_added = Z_STRLEN_P(arg);
+ TRACE_APPEND_STRL(Z_STRVAL_P(arg), l_added);
TRACE_APPEND_STR("', ");
l_added += 3 + 1;
}
@@ -401,7 +403,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
break;
}
case IS_BOOL:
- if (Z_LVAL_PP(arg)) {
+ if (Z_LVAL_P(arg)) {
TRACE_APPEND_STR("true, ");
} else {
TRACE_APPEND_STR("false, ");
@@ -411,7 +413,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
TRACE_APPEND_STR("Resource id #");
/* break; */
case IS_LONG: {
- long lval = Z_LVAL_PP(arg);
+ long lval = Z_LVAL_P(arg);
char s_tmp[MAX_LENGTH_OF_LONG + 1];
int l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */
TRACE_APPEND_STRL(s_tmp, l_tmp);
@@ -419,7 +421,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
break;
}
case IS_DOUBLE: {
- double dval = Z_DVAL_PP(arg);
+ double dval = Z_DVAL_P(arg);
char *s_tmp;
int l_tmp;
@@ -435,18 +437,16 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
TRACE_APPEND_STR("Array, ");
break;
case IS_OBJECT: {
- const char *class_name;
- zend_uint class_name_len;
- int dup;
+ zend_string *class_name;
TRACE_APPEND_STR("Object(");
- dup = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC);
+ class_name = zend_get_object_classname(arg TSRMLS_CC);
- TRACE_APPEND_STRL(class_name, class_name_len);
- if(!dup) {
- efree((char*)class_name);
- }
+ TRACE_APPEND_STRL(class_name->val, class_name->len);
+//??? if(!dup) {
+//??? efree((char*)class_name);
+//??? }
TRACE_APPEND_STR("), ");
break;
@@ -458,15 +458,15 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
}
/* }}} */
-static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
+static int _build_trace_string(zval *frame TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
char *s_tmp, **str;
int *len, *num;
long line;
- HashTable *ht = Z_ARRVAL_PP(frame);
- zval **file, **tmp;
+ HashTable *ht = Z_ARRVAL_P(frame);
+ zval *file, *tmp;
- if (Z_TYPE_PP(frame) != IS_ARRAY) {
+ if (Z_TYPE_P(frame) != IS_ARRAY) {
zend_error(E_WARNING, "Expected array for frame %lu", hash_key->h);
return ZEND_HASH_APPLY_KEEP;
}
@@ -479,14 +479,16 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
sprintf(s_tmp, "#%d ", (*num)++);
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
efree(s_tmp);
- if (zend_hash_find(ht, "file", sizeof("file"), (void**)&file) == SUCCESS) {
- if (Z_TYPE_PP(file) != IS_STRING) {
+ file = zend_hash_str_find(ht, "file", sizeof("file")-1);
+ if (file) {
+ if (Z_TYPE_P(file) != IS_STRING) {
zend_error(E_WARNING, "Function name is no string");
TRACE_APPEND_STR("[unknown function]");
} else{
- if (zend_hash_find(ht, "line", sizeof("line"), (void**)&tmp) == SUCCESS) {
- if (Z_TYPE_PP(tmp) == IS_LONG) {
- line = Z_LVAL_PP(tmp);
+ tmp = zend_hash_str_find(ht, "line", sizeof("line")-1);
+ if (tmp) {
+ if (Z_TYPE_P(tmp) == IS_LONG) {
+ line = Z_LVAL_P(tmp);
} else {
zend_error(E_WARNING, "Line is no long");
line = 0;
@@ -494,8 +496,8 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
} else {
line = 0;
}
- s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 4 + 1);
- sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line);
+ s_tmp = emalloc(Z_STRLEN_P(file) + MAX_LENGTH_OF_LONG + 4 + 1);
+ sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_P(file), line);
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
efree(s_tmp);
}
@@ -506,10 +508,11 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
TRACE_APPEND_KEY("type");
TRACE_APPEND_KEY("function");
TRACE_APPEND_CHR('(');
- if (zend_hash_find(ht, "args", sizeof("args"), (void**)&tmp) == SUCCESS) {
- if (Z_TYPE_PP(tmp) == IS_ARRAY) {
+ tmp = zend_hash_str_find(ht, "args", sizeof("args")-1);
+ if (tmp) {
+ if (Z_TYPE_P(tmp) == IS_ARRAY) {
int last_len = *len;
- zend_hash_apply_with_arguments(Z_ARRVAL_PP(tmp) TSRMLS_CC, (apply_func_args_t)_build_trace_args, 2, str, len);
+ zend_hash_apply_with_arguments(Z_ARRVAL_P(tmp) TSRMLS_CC, (apply_func_args_t)_build_trace_args, 2, str, len);
if (last_len != *len) {
*len -= 2; /* remove last ', ' */
}
@@ -544,7 +547,8 @@ ZEND_METHOD(exception, getTraceAsString)
efree(s_tmp);
res[res_len] = '\0';
- RETURN_STRINGL(res, res_len, 0);
+//??? RETURN_STRINGL(res, res_len, 0);
+ RETURN_STRINGL(res, res_len);
}
/* }}} */
@@ -587,7 +591,7 @@ ZEND_METHOD(exception, __toString)
str = estrndup("", 0);
exception = getThis();
- ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 1);
+ ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1);
while (exception && Z_TYPE_P(exception) == IS_OBJECT) {
prev_str = str;
@@ -601,20 +605,20 @@ ZEND_METHOD(exception, __toString)
fci.size = sizeof(fci);
fci.function_table = &Z_OBJCE_P(exception)->function_table;
- fci.function_name = &fname;
+ ZVAL_COPY_VALUE(&fci.function_name, &fname);
fci.symbol_table = NULL;
fci.object_ptr = exception;
- fci.retval_ptr_ptr = &trace;
+//??? fci.retval_ptr_ptr = &trace;
fci.param_count = 0;
fci.params = NULL;
fci.no_separation = 1;
zend_call_function(&fci, NULL TSRMLS_CC);
- if (Z_TYPE_P(trace) != IS_STRING) {
- zval_ptr_dtor(&trace);
- trace = NULL;
- }
+//??? if (Z_TYPE_P(trace) != IS_STRING) {
+//??? zval_ptr_dtor(&trace);
+//??? trace = NULL;
+//??? }
if (Z_STRLEN(message) > 0) {
len = zend_spprintf(&str, 0, "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s%s%s",
@@ -634,9 +638,9 @@ ZEND_METHOD(exception, __toString)
exception = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 0 TSRMLS_CC);
- if (trace) {
- zval_ptr_dtor(&trace);
- }
+//??? if (trace) {
+//??? zval_ptr_dtor(&trace);
+//??? }
}
zval_dtor(&fname);
@@ -645,7 +649,8 @@ ZEND_METHOD(exception, __toString)
* the result in uncaught exception handlers without memleaks. */
zend_update_property_string(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC);
- RETURN_STRINGL(str, len, 0);
+//??? RETURN_STRINGL(str, len, 0);
+ RETURN_STRINGL(str, len);
}
/* }}} */
@@ -714,7 +719,7 @@ void zend_register_default_exception(TSRMLS_D) /* {{{ */
zend_declare_property_null(default_exception_ce, "previous", sizeof("previous")-1, ZEND_ACC_PRIVATE TSRMLS_CC);
INIT_CLASS_ENTRY(ce, "ErrorException", error_exception_functions);
- error_exception_ce = zend_register_internal_class_ex(&ce, default_exception_ce, NULL TSRMLS_CC);
+ error_exception_ce = zend_register_internal_class_ex(&ce, default_exception_ce TSRMLS_CC);
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);
}
@@ -732,11 +737,10 @@ ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */
}
/* }}} */
-ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC) /* {{{ */
+ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC) /* {{{ */
{
- zval *ex;
+ zval ex;
- MAKE_STD_ZVAL(ex);
if (exception_ce) {
if (!instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) {
zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class");
@@ -745,41 +749,43 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char
} else {
exception_ce = default_exception_ce;
}
- object_init_ex(ex, exception_ce);
+ object_init_ex(&ex, exception_ce);
if (message) {
- zend_update_property_string(default_exception_ce, ex, "message", sizeof("message")-1, message TSRMLS_CC);
+ zend_update_property_string(default_exception_ce, &ex, "message", sizeof("message")-1, message TSRMLS_CC);
}
if (code) {
- zend_update_property_long(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);
- return ex;
+ zend_throw_exception_internal(&ex TSRMLS_CC);
+ return Z_OBJ(ex);
}
/* }}} */
-ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */
+ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */
{
va_list arg;
char *message;
- zval *zexception;
+ zend_object *obj;
va_start(arg, format);
zend_vspprintf(&message, 0, format, arg);
va_end(arg);
- zexception = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
+ obj = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
efree(message);
- return zexception;
+ return obj;
}
/* }}} */
-ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC) /* {{{ */
+ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const 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;
+ zval ex;
+ zend_object *obj = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
+ ZVAL_OBJ(&ex, obj);
+ zend_update_property_long(default_exception_ce, &ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
+ return obj;
}
/* }}} */
@@ -794,29 +800,36 @@ static void zend_error_va(int type, const char *file, uint lineno, const char *f
/* }}} */
/* This function doesn't return if it uses E_ERROR */
-ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {{{ */
+ZEND_API void zend_exception_error(zend_object *ex, int severity TSRMLS_DC) /* {{{ */
{
- zend_class_entry *ce_exception = Z_OBJCE_P(exception);
+ zval exception;
+ zend_class_entry *ce_exception;
+
+ ZVAL_OBJ(&exception, ex);
+ ce_exception = Z_OBJCE(exception);
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
- zval *str, *file, *line;
+ zval tmp, *str, *file, *line;
EG(exception) = NULL;
- zend_call_method_with_0_params(&exception, ce_exception, NULL, "__tostring", &str);
+ zend_call_method_with_0_params(&exception, ce_exception, NULL, "__tostring", &tmp);
if (!EG(exception)) {
- if (Z_TYPE_P(str) != IS_STRING) {
- zend_error(E_WARNING, "%s::__toString() must return a string", ce_exception->name);
+ if (Z_TYPE(tmp) != IS_STRING) {
+ zend_error(E_WARNING, "%s::__toString() must return a string", ce_exception->name->val);
} else {
- zend_update_property_string(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->val : Z_STRVAL(tmp) TSRMLS_CC);
}
}
- zval_ptr_dtor(&str);
+ zval_ptr_dtor(&tmp);
if (EG(exception)) {
+ zval zv;
+
+ ZVAL_OBJ(&zv, EG(exception));
/* do the best we can to inform about the inner exception */
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);
+ file = zend_read_property(default_exception_ce, &zv, "file", sizeof("file")-1, 1 TSRMLS_CC);
+ line = zend_read_property(default_exception_ce, &zv, "line", sizeof("line")-1, 1 TSRMLS_CC);
convert_to_string(file);
file = (Z_STRLEN_P(file) > 0) ? file : NULL;
@@ -825,12 +838,12 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {
file = NULL;
line = NULL;
}
- zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, "Uncaught %s in exception handling during call to %s::__tostring()", Z_OBJCE_P(EG(exception))->name, ce_exception->name);
+ zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, "Uncaught %s in exception handling during call to %s::__tostring()", Z_OBJCE(zv)->name->val, ce_exception->name->val);
}
- 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);
+ 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);
convert_to_string(str);
convert_to_string(file);
@@ -838,7 +851,7 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {
zend_error_va(severity, (Z_STRLEN_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str));
} else {
- zend_error(severity, "Uncaught exception '%s'", ce_exception->name);
+ zend_error(severity, "Uncaught exception '%s'", ce_exception->name->val);
}
}
/* }}} */