diff --git a/src/Assert.php b/src/Assert.php index 1d175bb7..bebde6ca 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -190,6 +190,7 @@ class Assert { protected static $throwException = true; + protected static $maxStringLength = 1024; public static function setThrowException(bool $b) { @@ -1332,7 +1333,11 @@ protected static function valueToString($value): string } if (is_string($value)) { - return 'string(' . strlen($value) . ') "' . $value . '"'; + $length = strlen($value); + if ($length > static::$maxStringLength) { + $value = substr($value, 0, static::$maxStringLength) . '...'; + } + return 'string(' . $length . ') "' . $value . '"'; } return (string)$value;