From 6b238610747c4edf20284b3df57072f010af8ffd Mon Sep 17 00:00:00 2001 From: Jules Pietri Date: Tue, 8 Mar 2016 13:31:59 +0100 Subject: [PATCH] [WebProfilerBundle] fix context log pre wrap --- .../Resources/views/Profiler/profiler.css.twig | 1 + .../HttpKernel/DataCollector/Util/ValueExporter.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig index e81a415f58..327a98aeba 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig @@ -827,6 +827,7 @@ table.logs .metadata .context { table.logs .metadata .context pre { margin: 5px 0; padding: 5px 10px; + white-space: pre-wrap; } table.logs .sf-call-stack { diff --git a/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php b/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php index c9e51cc26f..8642b5a64f 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php @@ -58,7 +58,13 @@ class ValueExporter return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1)); } - return sprintf('[%s]', implode(', ', $a)); + $s = sprintf('[%s]', implode(', ', $a)); + + if (80 > strlen($s)) { + return $s; + } + + return sprintf("[\n%s%s\n]", $indent, implode(sprintf(",\n%s", $indent), $a)); } if (is_resource($value)) {