Improve stack trace rendering, show array and string lengths

This commit is contained in:
Dylan K. Taylor 2019-06-06 14:53:50 +01:00
parent eb161f8e1c
commit 9f31b479e1

View File

@ -47,7 +47,6 @@ use function file;
use function file_exists;
use function file_get_contents;
use function function_exists;
use function get_class;
use function get_current_user;
use function get_loaded_extensions;
use function getenv;
@ -83,7 +82,6 @@ use function stripos;
use function strlen;
use function strpos;
use function strtolower;
use function strval;
use function substr;
use function sys_get_temp_dir;
use function trim;
@ -606,7 +604,16 @@ class Utils{
}
$params = implode(", ", array_map(function($value){
return (is_object($value) ? get_class($value) . " object" : gettype($value) . " " . (is_array($value) ? "Array()" : Utils::printable(@strval($value))));
if(is_object($value)){
return "object " . self::getNiceClassName($value);
}
if(is_array($value)){
return "array[" . count($value) . "]";
}
if(is_string($value)){
return "string[" . strlen($value) . "] " . Utils::printable($value);
}
return gettype($value) . " " . Utils::printable((string) $value);
}, $args));
}
$messages[] = "#$i " . (isset($trace[$i]["file"]) ? self::cleanPath($trace[$i]["file"]) : "") . "(" . (isset($trace[$i]["line"]) ? $trace[$i]["line"] : "") . "): " . (isset($trace[$i]["class"]) ? $trace[$i]["class"] . (($trace[$i]["type"] === "dynamic" or $trace[$i]["type"] === "->") ? "->" : "::") : "") . $trace[$i]["function"] . "(" . Utils::printable($params) . ")";