diff --git a/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php b/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php index de5fa59bc..b3e2b5f0f 100644 --- a/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php +++ b/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php @@ -5,6 +5,7 @@ use Enqueue\Client\MessagePriority; use Enqueue\Client\ProducerInterface; use Enqueue\Client\TraceableProducer; +use Enqueue\Util\JSON; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DataCollector\DataCollector; @@ -65,19 +66,13 @@ public function prettyPrintPriority($priority) } /** - * @param string $message + * @param mixed $body * * @return string */ - public function prettyPrintMessage($message) + public function ensureString($body) { - if (is_scalar($message)) { - return htmlspecialchars($message); - } - - return htmlspecialchars( - json_encode($message, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) - ); + return is_string($body) ? $body : JSON::encode($body); } /** diff --git a/pkg/enqueue-bundle/Resources/views/Profiler/panel.html.twig b/pkg/enqueue-bundle/Resources/views/Profiler/panel.html.twig index a8f783dfc..635a540d7 100644 --- a/pkg/enqueue-bundle/Resources/views/Profiler/panel.html.twig +++ b/pkg/enqueue-bundle/Resources/views/Profiler/panel.html.twig @@ -44,7 +44,10 @@