Skip to content

Commit 0007a5d

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: don't use deprecated and internal Twig functions [FrameworkBundle] Add missing webhook parsers [FrameworkBundle] Fix webhook parser service removal and add notifier parser service removal [Notifier][Clickatell] Fixed minor typo add missing translation [Messenger] Add missing Redis cleanup in tests Make sure Serializer::denormalize have show what exception it throws [WebProfilerBundle] Fix "Copy as cURL" dark style
2 parents 9c20654 + 435652b commit 0007a5d

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

Resources/views/Profiler/base_js.html.twig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,10 @@
186186
187187
copyToClipboardElement.textContent = `✅ Copied!`;
188188
copyToClipboardElement.disabled = true;
189-
copyToClipboardElement.classList.add('status-success');
190189
191190
setTimeout(() => {
192191
copyToClipboardElement.textContent = oldContent;
193192
copyToClipboardElement.disabled = false;
194-
copyToClipboardElement.classList.remove('status-success');
195193
}, 7000);
196194
});
197195
});

Tests/Twig/WebProfilerExtensionTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
use Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension;
1616
use Symfony\Component\VarDumper\Cloner\VarCloner;
1717
use Twig\Environment;
18-
use Twig\Extension\CoreExtension;
19-
use Twig\Extension\EscaperExtension;
2018

2119
class WebProfilerExtensionTest extends TestCase
2220
{
@@ -25,9 +23,6 @@ class WebProfilerExtensionTest extends TestCase
2523
*/
2624
public function testDumpHeaderIsDisplayed(string $message, array $context, bool $dump1HasHeader, bool $dump2HasHeader)
2725
{
28-
class_exists(CoreExtension::class); // Load twig_convert_encoding()
29-
class_exists(EscaperExtension::class); // Load twig_escape_filter()
30-
3126
$twigEnvironment = $this->mockTwigEnvironment();
3227
$varCloner = new VarCloner();
3328

Twig/WebProfilerExtension.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\VarDumper\Cloner\Data;
1515
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
1616
use Twig\Environment;
17+
use Twig\Extension\EscaperExtension;
1718
use Twig\Extension\ProfilerExtension;
1819
use Twig\Profiler\Profile;
1920
use Twig\TwigFunction;
@@ -78,12 +79,12 @@ public function dumpData(Environment $env, Data $data, int $maxDepth = 0): strin
7879

7980
public function dumpLog(Environment $env, string $message, Data $context = null): string
8081
{
81-
$message = twig_escape_filter($env, $message);
82+
$message = self::escape($env, $message);
8283
$message = preg_replace('/&quot;(.*?)&quot;/', '&quot;<b>$1</b>&quot;', $message);
8384

8485
$replacements = [];
8586
foreach ($context ?? [] as $k => $v) {
86-
$k = '{'.twig_escape_filter($env, $k).'}';
87+
$k = '{'.self::escape($env, $k).'}';
8788
if (str_contains($message, $k)) {
8889
$replacements[$k] = $v;
8990
}
@@ -104,4 +105,14 @@ public function getName(): string
104105
{
105106
return 'profiler';
106107
}
108+
109+
private static function escape(Environment $env, string $s): string
110+
{
111+
if (method_exists(EscaperExtension::class, 'escape')) {
112+
return EscaperExtension::escape($env, $s);
113+
}
114+
115+
// to be removed when support for Twig 3 is dropped
116+
return twig_escape_filter($env, $s);
117+
}
107118
}

0 commit comments

Comments
 (0)