diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2015-08-18 12:48:06 +0200 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2015-08-18 12:48:06 +0200 |
commit | c83cbdf6cee19914bb9c7722e956ccc8a9cb5a54 (patch) | |
tree | f99d9db4eaacaff34108ab45c9b8cb72fb4c13b5 /Zend/zend_exceptions.c | |
parent | d9a9b8572b0064acb5773b795f7deb9cfa8b7a25 (diff) | |
download | php-git-c83cbdf6cee19914bb9c7722e956ccc8a9cb5a54.tar.gz |
Better fix for exception traces truncation with anon classes
Diffstat (limited to 'Zend/zend_exceptions.c')
-rw-r--r-- | Zend/zend_exceptions.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 307589b5fe..3af0b5ac07 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -29,6 +29,7 @@ #include "zend_vm.h" #include "zend_dtrace.h" #include "zend_smart_str.h" +#include "php_globals.h" ZEND_API zend_class_entry *zend_ce_throwable; ZEND_API zend_class_entry *zend_ce_exception; @@ -442,7 +443,7 @@ ZEND_METHOD(error_exception, getSeverity) zend_error(E_WARNING, "Value for %s is no string", key); \ smart_str_appends(str, "[unknown]"); \ } else { \ - smart_str_append(str, Z_STR_P(tmp)); \ + smart_str_appends(str, Z_STRVAL_P(tmp)); \ } \ } \ } while (0) @@ -556,7 +557,7 @@ static void _build_trace_args(zval *arg, smart_str *str) /* {{{ */ break; case IS_OBJECT: smart_str_appends(str, "Object("); - smart_str_append(str, Z_OBJCE_P(arg)->name); + smart_str_appends(str, ZSTR_VAL(Z_OBJCE_P(arg)->name)); smart_str_appends(str, "), "); break; } @@ -1007,7 +1008,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ if (Z_TYPE(tmp) != IS_STRING) { zend_error(E_WARNING, "%s::__toString() must return a string", ZSTR_VAL(ce_exception->name)); } else { - zend_update_property_string(i_get_exception_base(&exception), &exception, "string", sizeof("string")-1, EG(exception) ? ZSTR_VAL(ce_exception->name) : Z_STRVAL(tmp)); + zend_update_property(i_get_exception_base(&exception), &exception, "string", sizeof("string")-1, &tmp); } } zval_ptr_dtor(&tmp); @@ -1036,7 +1037,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ line = zval_get_long(GET_PROPERTY_SILENT(&exception, "line")); zend_error_va(severity, (file && ZSTR_LEN(file) > 0) ? ZSTR_VAL(file) : NULL, line, - "Uncaught %s\n thrown", ZSTR_VAL(str)); + "Uncaught %.*s\n thrown", PG(log_errors_max_len) ? MIN(ZSTR_LEN(str), MAX(PG(log_errors_max_len) - 18, 0)) : ZSTR_LEN(str), ZSTR_VAL(str)); zend_string_release(str); zend_string_release(file); |