}
/* }}} */
-static inline zend_class_entry *zend_get_exception_base(zval *object)
+static inline zend_class_entry *i_get_exception_base(zval *object)
{
return instanceof_function(Z_OBJCE_P(object), default_exception_ce) ? default_exception_ce : error_ce;
}
+ZEND_API zend_class_entry *zend_get_exception_base(zval *object)
+{
+ return i_get_exception_base(object);
+}
+
void zend_exception_set_previous(zend_object *exception, zend_object *add_previous)
{
zval tmp, *previous, zv, *pzv, rv;
ZVAL_OBJ(&zv, exception);
pzv = &zv;
do {
- base_ce = zend_get_exception_base(pzv);
+ base_ce = i_get_exception_base(pzv);
previous = zend_read_property(base_ce, pzv, "previous", sizeof("previous")-1, 1, &rv);
if (Z_TYPE_P(previous) == IS_NULL) {
zend_update_property(base_ce, pzv, "previous", sizeof("previous")-1, &tmp);
}
Z_SET_REFCOUNT(trace, 0);
- base_ce = zend_get_exception_base(&obj);
+ base_ce = i_get_exception_base(&obj);
if (EXPECTED(class_type != parse_error_ce || !(filename = zend_get_compiled_filename()))) {
zend_update_property_string(base_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename());
int argc = ZEND_NUM_ARGS();
object = getThis();
- base_ce = zend_get_exception_base(object);
+ base_ce = i_get_exception_base(object);
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, "|SlO!", &message, &code, &previous, zend_ce_throwable) == FAILURE) {
zend_class_entry *ce;
}
#define GET_PROPERTY(object, name) \
- zend_read_property(zend_get_exception_base(object), (object), name, sizeof(name) - 1, 0, &rv)
+ zend_read_property(i_get_exception_base(object), (object), name, sizeof(name) - 1, 0, &rv)
#define GET_PROPERTY_SILENT(object, name) \
- zend_read_property(zend_get_exception_base(object), (object), name, sizeof(name) - 1, 1, &rv)
+ zend_read_property(i_get_exception_base(object), (object), name, sizeof(name) - 1, 1, &rv)
/* {{{ proto string Exception|Error::getFile()
Get the file in which the exception occurred */
DEFAULT_0_PARAMS;
object = getThis();
- base_ce = zend_get_exception_base(object);
+ base_ce = i_get_exception_base(object);
trace = zend_read_property(base_ce, object, "trace", sizeof("trace")-1, 1, &rv);
if (Z_TYPE_P(trace) != IS_ARRAY) {
zval_dtor(&fname);
exception = getThis();
- base_ce = zend_get_exception_base(exception);
+ base_ce = i_get_exception_base(exception);
/* We store the result in the private property string so we can access
* the result in uncaught exception handlers without memleaks. */
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(zend_get_exception_base(&exception), &exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name->val : Z_STRVAL(tmp));
+ zend_update_property_string(i_get_exception_base(&exception), &exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name->val : Z_STRVAL(tmp));
}
}
zval_ptr_dtor(&tmp);
/* check for uncaught exceptions */
if (exception && PHPDBG_G(handled_exception) != exception) {
zend_execute_data *prev_ex = execute_data;
+ zval zv, rv;
+ zend_string *file;
+ zend_long line;
do {
prev_ex = zend_generator_check_placeholder_frame(prev_ex);
} while ((prev_ex = prev_ex->prev_execute_data));
PHPDBG_G(handled_exception) = exception;
- phpdbg_error("exception", "name=\"%s\"", "Uncaught exception %s", exception->ce->name->val);
+
+ ZVAL_OBJ(&zv, exception);
+ file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
+ line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
+
+ phpdbg_error("exception", "name=\"%s\" file=\"%s\" line=\"%lld\"", "Uncaught exception %s in %s on line %lld", exception->ce->name->val, file->val, line);
+ zend_string_release(file);
DO_INTERACTIVE(1);
}
ex_is_caught: