1. Fixed bug #69640 Unhandled EngineExceptions thrown from userland do not produce any output

2. Fixed Segfault introduced by latest changes
This commit is contained in:
Xinchen Hui 2015-05-18 11:09:09 +08:00
parent d02deee677
commit a5f408c91b

View File

@ -158,6 +158,7 @@ static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type,
zval obj;
zend_object *object;
zval trace;
zend_string *filename;
Z_OBJ(obj) = object = zend_objects_new(class_type);
Z_OBJ_HT(obj) = &default_exception_handlers;
@ -171,11 +172,11 @@ static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type,
}
Z_SET_REFCOUNT(trace, 0);
if (EXPECTED(class_type != parse_exception_ce)) {
if (EXPECTED(class_type != parse_exception_ce || !(filename = zend_get_compiled_filename()))) {
zend_update_property_string(base_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename());
zend_update_property_long(base_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno());
} else {
zend_update_property_string(base_exception_ce, &obj, "file", sizeof("file")-1, zend_get_compiled_filename()->val);
zend_update_property_string(base_exception_ce, &obj, "file", sizeof("file")-1, filename->val);
zend_update_property_long(base_exception_ce, &obj, "line", sizeof("line")-1, zend_get_compiled_lineno());
}
zend_update_property(base_exception_ce, &obj, "trace", sizeof("trace")-1, &trace);
@ -920,7 +921,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */
zend_long line = zval_get_long(GET_PROPERTY_SILENT(&exception, "line"));
zend_long code = zval_get_long(GET_PROPERTY_SILENT(&exception, "code"));
zend_error_helper(code, file->val, line, "%s", message->val);
zend_error_helper(code? code : E_ERROR, file->val, line, "%s", message->val);
zend_string_release(file);
zend_string_release(message);