Skip to content

Commit

Permalink
1. Fixed bug #69640 Unhandled EngineExceptions thrown from userland d…
Browse files Browse the repository at this point in the history
…o not produce any output

2. Fixed Segfault introduced by latest changes
  • Loading branch information
laruence committed May 18, 2015
1 parent d02deee commit a5f408c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Zend/zend_exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a5f408c

Please sign in to comment.