From f457ed4a66672a28638bafc486f0ba8bcb8047df Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 24 Jan 2023 15:02:24 +0100 Subject: [PATCH 01/14] Update license years (last time) --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 00837045..0138f8f0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2023 Fabien Potencier +Copyright (c) 2004-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 2d4645eb96dc14f95c9cd98754cd8ba0a063b563 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 3 Feb 2023 15:37:15 +0100 Subject: [PATCH 02/14] [WebProfilerBundle] Fix an accessibility issue in the search form of the header --- Resources/views/Profiler/header.html.twig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Resources/views/Profiler/header.html.twig b/Resources/views/Profiler/header.html.twig index ac62bdcf..e568d7e6 100644 --- a/Resources/views/Profiler/header.html.twig +++ b/Resources/views/Profiler/header.html.twig @@ -4,7 +4,8 @@ From 07291461328fd8eafe6d2b52ba00a507ae2cd278 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 3 Feb 2023 17:15:41 +0100 Subject: [PATCH 03/14] [WebProfilerBundle] Disable Turbo for debug toolbar links --- Resources/views/Profiler/toolbar.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/Profiler/toolbar.html.twig b/Resources/views/Profiler/toolbar.html.twig index 236fc70d..8d06534d 100644 --- a/Resources/views/Profiler/toolbar.html.twig +++ b/Resources/views/Profiler/toolbar.html.twig @@ -1,5 +1,5 @@ -
+
From 23f8e959cd06448acd90357503fc132dc92835b3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 3 Feb 2023 14:52:28 +0100 Subject: [PATCH 04/14] [WebProfilerBundle] Fix some minor HTML issues --- Resources/views/Collector/logger.html.twig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Resources/views/Collector/logger.html.twig b/Resources/views/Collector/logger.html.twig index b1642d4e..9f94dde6 100644 --- a/Resources/views/Collector/logger.html.twig +++ b/Resources/views/Collector/logger.html.twig @@ -131,8 +131,10 @@ - Time - Message + + Time + Message + @@ -185,7 +187,7 @@

Container Compilation Logs ({{ compilerLogTotal }})

-

Log messages generated during the compilation of the service container.

+ Log messages generated during the compilation of the service container.
{% if collector.compilerLogs is empty %} From ab75733d2bcee16d0848ffacf49c5c61d09734da Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 7 Feb 2023 21:09:05 +0100 Subject: [PATCH 05/14] [Tests] Migrate tests to static data providers --- Tests/Controller/ProfilerControllerTest.php | 146 +++++++++++++------- 1 file changed, 94 insertions(+), 52 deletions(-) diff --git a/Tests/Controller/ProfilerControllerTest.php b/Tests/Controller/ProfilerControllerTest.php index 86de485e..f071aaad 100644 --- a/Tests/Controller/ProfilerControllerTest.php +++ b/Tests/Controller/ProfilerControllerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\WebProfilerBundle\Tests\Controller; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController; @@ -366,6 +367,99 @@ public function provideCspVariants() * @dataProvider defaultPanelProvider */ public function testDefaultPanel(string $expectedPanel, Profile $profile) + { + $this->assertDefaultPanel($expectedPanel, $profile); + } + + public static function defaultPanelProvider(): \Generator + { + // Test default behavior + $profile = new Profile('xxxxxx'); + $profile->addCollector($requestDataCollector = new RequestDataCollector()); + yield [$requestDataCollector->getName(), $profile]; + + // Test exception + $profile = new Profile('xxxxxx'); + $profile->addCollector($exceptionDataCollector = new ExceptionDataCollector()); + $exceptionDataCollector->collect(new Request(), new Response(), new \DomainException()); + yield [$exceptionDataCollector->getName(), $profile]; + } + + private function createController($profiler, $twig, $withCSP, array $templates = []): ProfilerController + { + $urlGenerator = $this->createMock(UrlGeneratorInterface::class); + + if ($withCSP) { + $nonceGenerator = $this->createMock(NonceGenerator::class); + $nonceGenerator->method('generate')->willReturn('dummy_nonce'); + + return new ProfilerController($urlGenerator, $profiler, $twig, $templates, new ContentSecurityPolicyHandler($nonceGenerator)); + } + + return new ProfilerController($urlGenerator, $profiler, $twig, $templates); + } + + public function testDumpPanelExceptionPriority() + { + $exceptionDataCollector = new ExceptionDataCollector(); + $exceptionDataCollector->collect(new Request(), new Response(), new \DomainException()); + + $dumpDataCollector = $this->createDumpDataCollector(); + + $profile = new Profile('xxxxxx'); + $profile->setCollectors([$exceptionDataCollector, $dumpDataCollector]); + + $this->assertDefaultPanel($exceptionDataCollector->getName(), $profile); + } + + public function testDumpPanelWhenDefinedAfterwards() + { + $exceptionDataCollector = new ExceptionDataCollector(); + $exceptionDataCollector->collect(new Request(), new Response(), new \DomainException()); + + $dumpDataCollector = $this->createDumpDataCollector(); + $dumpDataCollector + ->expects($this->atLeastOnce()) + ->method('getDumpsCount') + ->willReturn(1) + ; + + $profile = new Profile('xxxxxx'); + $profile->setCollectors([$dumpDataCollector, $exceptionDataCollector]); + + $this->assertDefaultPanel($exceptionDataCollector->getName(), $profile); + } + + public function testDumpPanel() + { + $dumpDataCollector = $this->createDumpDataCollector(); + $dumpDataCollector + ->expects($this->atLeastOnce()) + ->method('getDumpsCount') + ->willReturn(1) + ; + + $profile = new Profile('xxxxxx'); + $profile->addCollector($dumpDataCollector); + + $this->assertDefaultPanel($dumpDataCollector->getName(), $profile); + } + + /** + * @return MockObject + */ + private function createDumpDataCollector(): MockObject + { + $dumpDataCollector = $this->createMock(DumpDataCollector::class); + $dumpDataCollector + ->expects($this->atLeastOnce()) + ->method('getName') + ->willReturn('dump'); + + return $dumpDataCollector; + } + + private function assertDefaultPanel(string $expectedPanel, Profile $profile) { $profiler = $this->createMock(Profiler::class); $profiler @@ -415,56 +509,4 @@ public function testDefaultPanel(string $expectedPanel, Profile $profile) }, $collectorsNames)) ->panelAction(new Request(), $profile->getToken()); } - - public function defaultPanelProvider(): \Generator - { - // Test default behavior - $profile = new Profile('xxxxxx'); - $profile->addCollector($requestDataCollector = new RequestDataCollector()); - yield [$requestDataCollector->getName(), $profile]; - - // Test exception - $profile = new Profile('xxxxxx'); - $profile->addCollector($exceptionDataCollector = new ExceptionDataCollector()); - $exceptionDataCollector->collect(new Request(), new Response(), new \DomainException()); - yield [$exceptionDataCollector->getName(), $profile]; - - // Test exception priority - $dumpDataCollector = $this->createMock(DumpDataCollector::class); - $dumpDataCollector - ->expects($this->atLeastOnce()) - ->method('getName') - ->willReturn('dump'); - $dumpDataCollector - ->expects($this->atLeastOnce()) - ->method('getDumpsCount') - ->willReturn(1); - $profile = new Profile('xxxxxx'); - $profile->setCollectors([$exceptionDataCollector, $dumpDataCollector]); - yield [$exceptionDataCollector->getName(), $profile]; - - // Test exception priority when defined afterwards - $profile = new Profile('xxxxxx'); - $profile->setCollectors([$dumpDataCollector, $exceptionDataCollector]); - yield [$exceptionDataCollector->getName(), $profile]; - - // Test dump - $profile = new Profile('xxxxxx'); - $profile->addCollector($dumpDataCollector); - yield [$dumpDataCollector->getName(), $profile]; - } - - private function createController($profiler, $twig, $withCSP, array $templates = []): ProfilerController - { - $urlGenerator = $this->createMock(UrlGeneratorInterface::class); - - if ($withCSP) { - $nonceGenerator = $this->createMock(NonceGenerator::class); - $nonceGenerator->method('generate')->willReturn('dummy_nonce'); - - return new ProfilerController($urlGenerator, $profiler, $twig, $templates, new ContentSecurityPolicyHandler($nonceGenerator)); - } - - return new ProfilerController($urlGenerator, $profiler, $twig, $templates); - } } From ea3fd946fb59df310eb8c8f59f060d2fea841ae7 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 10 Feb 2023 11:12:15 +0100 Subject: [PATCH 06/14] [Notifier] Fix notifier profiler when transport name is null --- Resources/views/Collector/notifier.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/views/Collector/notifier.html.twig b/Resources/views/Collector/notifier.html.twig index dd17fab9..eb43fc98 100644 --- a/Resources/views/Collector/notifier.html.twig +++ b/Resources/views/Collector/notifier.html.twig @@ -17,7 +17,7 @@ {% for transport in events.transports %}
- {{ transport }} + {{ transport ?: 'Empty Transport Name' }} {{ events.messages(transport)|length }}
{% endfor %} @@ -100,7 +100,7 @@
{% for transport in events.transports %} -

{{ transport }}

+

{{ transport ?: 'Empty Transport Name' }}

From 0ea68fb04e865ee170dd4c4f278d3f22538ba8c4 Mon Sep 17 00:00:00 2001 From: Mathieu Date: Thu, 9 Feb 2023 10:31:08 +0100 Subject: [PATCH 07/14] [Notifier][WebProfilerBundle] Ignore messages whose `getNotification` returns `null` --- Resources/views/Collector/notifier.html.twig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Resources/views/Collector/notifier.html.twig b/Resources/views/Collector/notifier.html.twig index dd17fab9..b6f25a39 100644 --- a/Resources/views/Collector/notifier.html.twig +++ b/Resources/views/Collector/notifier.html.twig @@ -114,24 +114,24 @@ Subject

{{ message.getSubject() ?? '(empty)' }}

- {% if message.getNotification is defined %} + {% set notification = message.notification ?? null %} + {% if notification %}
Content -
{{ message.getNotification().getContent() ?? '(empty)' }}
+
{{ notification.getContent() ?? '(empty)' }}
Importance -
{{ message.getNotification().getImportance() }}
+
{{ notification.getImportance() }}
{% endif %}
- {% if message.getNotification is defined %} + {% if notification %}

Notification

- {% set notification = event.message.getNotification() %}
                                                             {{- 'Subject: ' ~ notification.getSubject() }}
From 17553708350db2342e804f1ed32f3b2864695104 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Fri, 10 Feb 2023 14:51:15 +0100 Subject: [PATCH 08/14] [Tests] Fix static calls and Mock var annotation --- Tests/Controller/ProfilerControllerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Controller/ProfilerControllerTest.php b/Tests/Controller/ProfilerControllerTest.php index f071aaad..5664b8b9 100644 --- a/Tests/Controller/ProfilerControllerTest.php +++ b/Tests/Controller/ProfilerControllerTest.php @@ -446,7 +446,7 @@ public function testDumpPanel() } /** - * @return MockObject + * @return MockObject&DumpDataCollector */ private function createDumpDataCollector(): MockObject { From 5638d82c491fa94bf0c1ba74d17d74e9a852fa86 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 14 Dec 2022 15:42:16 +0100 Subject: [PATCH 09/14] Migrate to `static` data providers using `rector/rector` --- Tests/Controller/ProfilerControllerTest.php | 6 +++--- Tests/Csp/ContentSecurityPolicyHandlerTest.php | 4 ++-- Tests/DependencyInjection/ConfigurationTest.php | 4 ++-- Tests/DependencyInjection/WebProfilerExtensionTest.php | 6 +++--- Tests/EventListener/WebDebugToolbarListenerTest.php | 4 ++-- Tests/Resources/IconTest.php | 2 +- Tests/Twig/WebProfilerExtensionTest.php | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Tests/Controller/ProfilerControllerTest.php b/Tests/Controller/ProfilerControllerTest.php index 5664b8b9..67355d90 100644 --- a/Tests/Controller/ProfilerControllerTest.php +++ b/Tests/Controller/ProfilerControllerTest.php @@ -136,7 +136,7 @@ public function testToolbarActionWithEmptyToken($token) $this->assertEquals(200, $response->getStatusCode()); } - public function getEmptyTokenCases() + public static function getEmptyTokenCases() { return [ [null], @@ -165,7 +165,7 @@ public function testOpeningDisallowedPaths($path, $isAllowed) } } - public function getOpenFileCases() + public static function getOpenFileCases() { return [ ['README.md', true], @@ -355,7 +355,7 @@ public function testPhpinfoAction() $this->assertStringContainsString('PHP License', $client->getResponse()->getContent()); } - public function provideCspVariants() + public static function provideCspVariants() { return [ [true], diff --git a/Tests/Csp/ContentSecurityPolicyHandlerTest.php b/Tests/Csp/ContentSecurityPolicyHandlerTest.php index c345b5fb..7d5c0761 100644 --- a/Tests/Csp/ContentSecurityPolicyHandlerTest.php +++ b/Tests/Csp/ContentSecurityPolicyHandlerTest.php @@ -46,7 +46,7 @@ public function testOnKernelResponse($nonce, $expectedNonce, Request $request, R } } - public function provideRequestAndResponses() + public static function provideRequestAndResponses() { $nonce = bin2hex(random_bytes(16)); @@ -73,7 +73,7 @@ public function provideRequestAndResponses() ]; } - public function provideRequestAndResponsesForOnKernelResponse() + public static function provideRequestAndResponsesForOnKernelResponse() { $nonce = bin2hex(random_bytes(16)); diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index a0bc7f43..d957cafc 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -29,7 +29,7 @@ public function testConfigTree(array $options, array $expectedResult) $this->assertEquals($expectedResult, $config); } - public function getDebugModes() + public static function getDebugModes() { return [ [ @@ -71,7 +71,7 @@ public function testConfigTreeUsingInterceptRedirects(bool $interceptRedirects, $this->assertEquals($expectedResult, $config); } - public function getInterceptRedirectsConfiguration() + public static function getInterceptRedirectsConfiguration() { return [ [ diff --git a/Tests/DependencyInjection/WebProfilerExtensionTest.php b/Tests/DependencyInjection/WebProfilerExtensionTest.php index f4d0f7e0..84558032 100644 --- a/Tests/DependencyInjection/WebProfilerExtensionTest.php +++ b/Tests/DependencyInjection/WebProfilerExtensionTest.php @@ -103,7 +103,7 @@ public function testDefaultConfig($debug) self::assertSaneContainer($this->getCompiledContainer()); } - public function getDebugModes() + public static function getDebugModes() { return [ ['debug' => false], @@ -129,7 +129,7 @@ public function testToolbarConfig(bool $toolbarEnabled, bool $listenerInjected, } } - public function getToolbarConfig() + public static function getToolbarConfig() { return [ [ @@ -170,7 +170,7 @@ public function testToolbarConfigUsingInterceptRedirects( } } - public function getInterceptRedirectsToolbarConfig() + public static function getInterceptRedirectsToolbarConfig() { return [ [ diff --git a/Tests/EventListener/WebDebugToolbarListenerTest.php b/Tests/EventListener/WebDebugToolbarListenerTest.php index dd2de44b..fa085ffe 100644 --- a/Tests/EventListener/WebDebugToolbarListenerTest.php +++ b/Tests/EventListener/WebDebugToolbarListenerTest.php @@ -40,7 +40,7 @@ public function testInjectToolbar($content, $expected) $this->assertEquals($expected, $response->getContent()); } - public function getInjectToolbarTests() + public static function getInjectToolbarTests() { return [ ['', "\nWDT\n"], @@ -148,7 +148,7 @@ public function testToolbarIsNotInjectedOnRedirection($statusCode) $this->assertEquals('', $response->getContent()); } - public function provideRedirects() + public static function provideRedirects() { return [ [301], diff --git a/Tests/Resources/IconTest.php b/Tests/Resources/IconTest.php index a690721e..afbd6edf 100644 --- a/Tests/Resources/IconTest.php +++ b/Tests/Resources/IconTest.php @@ -23,7 +23,7 @@ public function testIconFileContents($iconFilePath) $this->assertMatchesRegularExpression('~.*~s', file_get_contents($iconFilePath), sprintf('The SVG metadata of the %s icon is different than expected (use the same as the other icons).', $iconFilePath)); } - public function provideIconFilePaths() + public static function provideIconFilePaths() { return array_map(function ($filePath) { return (array) $filePath; }, glob(__DIR__.'/../../Resources/views/Icon/*.svg')); } diff --git a/Tests/Twig/WebProfilerExtensionTest.php b/Tests/Twig/WebProfilerExtensionTest.php index 6b026bcc..1bb1296b 100644 --- a/Tests/Twig/WebProfilerExtensionTest.php +++ b/Tests/Twig/WebProfilerExtensionTest.php @@ -42,7 +42,7 @@ class_exists(EscaperExtension::class); // Load twig_escape_filter() self::assertSame($dump2HasHeader, str_contains($dump2, $needle)); } - public function provideMessages(): iterable + public static function provideMessages(): iterable { yield ['Some message', ['foo' => 'foo', 'bar' => 'bar'], false, true]; yield ['Some message {@see some text}', ['foo' => 'foo', 'bar' => 'bar'], false, true]; From 35d62eaf78c864e91b56381e7bdc0cada3dd3b88 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 14 Feb 2023 14:59:01 +0100 Subject: [PATCH 10/14] replace usages of the deprecated PHPUnit getMockClass() method --- .../WebProfilerExtensionTest.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Tests/DependencyInjection/WebProfilerExtensionTest.php b/Tests/DependencyInjection/WebProfilerExtensionTest.php index 84558032..2d9ae56f 100644 --- a/Tests/DependencyInjection/WebProfilerExtensionTest.php +++ b/Tests/DependencyInjection/WebProfilerExtensionTest.php @@ -22,6 +22,9 @@ use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector; use Symfony\Component\HttpKernel\KernelInterface; +use Symfony\Component\HttpKernel\Profiler\Profiler; +use Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface; +use Symfony\Component\Routing\RouterInterface; class WebProfilerExtensionTest extends TestCase { @@ -55,11 +58,15 @@ protected function setUp(): void $this->kernel = $this->createMock(KernelInterface::class); + $profiler = $this->createMock(Profiler::class); + $profilerStorage = $this->createMock(ProfilerStorageInterface::class); + $router = $this->createMock(RouterInterface::class); + $this->container = new ContainerBuilder(); $this->container->register('data_collector.dump', DumpDataCollector::class)->setPublic(true); $this->container->register('error_handler.error_renderer.html', HtmlErrorRenderer::class)->setPublic(true); $this->container->register('event_dispatcher', EventDispatcher::class)->setPublic(true); - $this->container->register('router', $this->getMockClass('Symfony\\Component\\Routing\\RouterInterface'))->setPublic(true); + $this->container->register('router', \get_class($router))->setPublic(true); $this->container->register('twig', 'Twig\Environment')->setPublic(true); $this->container->register('twig_loader', 'Twig\Loader\ArrayLoader')->addArgument([])->setPublic(true); $this->container->register('twig', 'Twig\Environment')->addArgument(new Reference('twig_loader'))->setPublic(true); @@ -71,9 +78,9 @@ protected function setUp(): void $this->container->setParameter('kernel.charset', 'UTF-8'); $this->container->setParameter('debug.file_link_format', null); $this->container->setParameter('profiler.class', ['Symfony\\Component\\HttpKernel\\Profiler\\Profiler']); - $this->container->register('profiler', $this->getMockClass('Symfony\\Component\\HttpKernel\\Profiler\\Profiler')) + $this->container->register('profiler', \get_class($profiler)) ->setPublic(true) - ->addArgument(new Definition($this->getMockClass('Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface'))); + ->addArgument(new Definition(\get_class($profilerStorage))); $this->container->setParameter('data_collector.templates', []); $this->container->set('kernel', $this->kernel); $this->container->addCompilerPass(new RegisterListenersPass()); From f562c78e00b703afa2e3c2c52ef2a12702818251 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 16 Feb 2023 10:33:00 +0100 Subject: [PATCH 11/14] CS fix --- Tests/EventListener/WebDebugToolbarListenerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/EventListener/WebDebugToolbarListenerTest.php b/Tests/EventListener/WebDebugToolbarListenerTest.php index fa085ffe..450802a3 100644 --- a/Tests/EventListener/WebDebugToolbarListenerTest.php +++ b/Tests/EventListener/WebDebugToolbarListenerTest.php @@ -134,6 +134,7 @@ public function testToolbarIsNotInjectedOnContentDispositionAttachment() /** * @depends testToolbarIsInjected + * * @dataProvider provideRedirects */ public function testToolbarIsNotInjectedOnRedirection($statusCode) From c975ea1f4a6a89f44f601b70d4e8aa85660cf058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Egyed?= Date: Wed, 15 Feb 2023 23:06:14 +0100 Subject: [PATCH 12/14] [WebProfilerBundle] Tweak Mailer panel rendering --- Resources/views/Collector/mailer.html.twig | 36 ++++++++++------------ 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/Resources/views/Collector/mailer.html.twig b/Resources/views/Collector/mailer.html.twig index 651c2a16..a42b8b33 100644 --- a/Resources/views/Collector/mailer.html.twig +++ b/Resources/views/Collector/mailer.html.twig @@ -90,8 +90,8 @@ {% for event in collector.events.events(transport) %} {{ loop.index }} - {{ event.message.headers.get('subject').bodyAsString() ?? '(No subject)' }} - {{ (event.message.headers.get('to').bodyAsString() ?? '(empty)')|replace({'To:': ''}) }} + {{ event.message.getSubject() ?? '(No subject)' }} + {{ event.message.getTo()|map(addr => addr.toString())|join(', ')|default('(empty)') }} {% endfor %} @@ -137,12 +137,12 @@

- {{ message.headers.get('subject').bodyAsString() ?? '(No subject)' }} + {{ message.getSubject() ?? '(No subject)' }}

-

From: {{ (message.headers.get('from').bodyAsString() ?? '(empty)')|replace({'From:': ''}) }}

-

To: {{ (message.headers.get('to').bodyAsString() ?? '(empty)')|replace({'To:': ''}) }}

- {% for header in message.headers.all|filter(header => (header.name ?? '') not in ['Subject', 'From', 'To']) %} +

From: {{ message.getFrom()|map(addr => addr.toString())|join(', ')|default('(empty)') }}

+

To: {{ message.getTo()|map(addr => addr.toString())|join(', ')|default('(empty)') }}

+ {% for header in message.headers.all|filter(header => (header.name ?? '')|lower not in ['subject', 'from', 'to']) %}

{{ header.toString }}

{% endfor %}
@@ -182,6 +182,17 @@
{% if message.htmlBody %} {% set htmlBody = message.htmlBody() %} +
+

HTML preview

+
+ +
+
+

HTML content

@@ -194,19 +205,6 @@
- -
-

HTML preview

-
-
-                                                    
-                                                
-
-
{% endif %} {% if message.textBody %} From 0d183e0a69652e348007e97ffff8d3ded9cc6d2d Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Tue, 21 Feb 2023 17:32:03 +0100 Subject: [PATCH 13/14] Fix the rendering of query explanation with Postgresql Postgresql (and some other platforms) provide a textual query explanation rather than a tabular one. The previous styles were working only for a tabular display. For text allowing to break words, `min-content` is the width of a single letter. --- Resources/views/Profiler/profiler.css.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/Profiler/profiler.css.twig b/Resources/views/Profiler/profiler.css.twig index 7fc32f99..953ee53f 100644 --- a/Resources/views/Profiler/profiler.css.twig +++ b/Resources/views/Profiler/profiler.css.twig @@ -2079,7 +2079,7 @@ tr.log-status-silenced > td:first-child:before { max-width: 888px; } .width-full .sql-explain { - max-width: min-content; + max-width: unset; } .sql-explain table td, .sql-explain table tr { word-break: normal; From 24b6f4370f1cd59aacfc5e799c8614b40776e9c8 Mon Sep 17 00:00:00 2001 From: Yanick Witschi Date: Mon, 24 Apr 2023 15:41:17 +0200 Subject: [PATCH 14/14] Check if trace.curlCommand is defined in profiler --- Resources/views/Collector/http_client.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/views/Collector/http_client.html.twig b/Resources/views/Collector/http_client.html.twig index ed926bf8..7fda5a93 100644 --- a/Resources/views/Collector/http_client.html.twig +++ b/Resources/views/Collector/http_client.html.twig @@ -91,7 +91,7 @@ Profile {% endif %} - {% if trace.curlCommand is not null %} + {% if trace.curlCommand is defined and trace.curlCommand %} @@ -107,7 +107,7 @@ {% endif %} Response - + {% if trace.http_code >= 500 %} {% set responseStatus = 'error' %} {% elseif trace.http_code >= 400 %}