diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
index 1d7b5910ddb17..9861277db0f81 100644
--- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
@@ -51,6 +51,7 @@ public function getFilters()
new \Twig_SimpleFilter('file_excerpt', array($this, 'fileExcerpt'), array('is_safe' => array('html'))),
new \Twig_SimpleFilter('format_file', array($this, 'formatFile'), array('is_safe' => array('html'))),
new \Twig_SimpleFilter('format_file_from_text', array($this, 'formatFileFromText'), array('is_safe' => array('html'))),
+ new \Twig_SimpleFilter('format_log_message', array($this, 'formatLogMessage'), array('is_safe' => array('html'))),
new \Twig_SimpleFilter('file_link', array($this, 'getFileLink')),
);
}
@@ -151,7 +152,7 @@ public function fileExcerpt($file, $line, $srcContext = 3)
}
for ($i = max($line - $srcContext, 1), $max = min($line + $srcContext, count($content)); $i <= $max; ++$i) {
- $lines[] = '
'.self::fixCodeMarkup($content[$i - 1]).'
';
+ $lines[] = ''.self::fixCodeMarkup($content[$i - 1]).'
';
}
return ''.implode("\n", $lines).'
';
@@ -183,9 +184,7 @@ public function formatFile($file, $line, $text = null)
$text = "$text at line $line";
if (false !== $link = $this->getFileLink($file, $line)) {
- $flags = ENT_COMPAT | ENT_SUBSTITUTE;
-
- return sprintf('%s', htmlspecialchars($link, $flags, $this->charset), $text);
+ return sprintf('%s', htmlspecialchars($link, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset), $text);
}
return $text;
@@ -215,6 +214,27 @@ public function formatFileFromText($text)
}, $text);
}
+ /**
+ * @internal
+ */
+ public function formatLogMessage($message, array $context)
+ {
+ if ($context && false !== strpos($message, '{')) {
+ $replacements = array();
+ foreach ($context as $key => $val) {
+ if (is_scalar($val)) {
+ $replacements['{'.$key.'}'] = $val;
+ }
+ }
+
+ if ($replacements) {
+ $message = strtr($message, $replacements);
+ }
+ }
+
+ return htmlspecialchars($message, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset);
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/logs.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/logs.html.twig
index f75ec585fcf0d..d2c3ac6940194 100644
--- a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/logs.html.twig
+++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/logs.html.twig
@@ -1,7 +1,7 @@
{% for log in logs %}
- = 400 %} class="error"{% elseif log.priority >= 300 %} class="warning"{% endif %}>
- {{ log.priorityName }} - {{ log.message }}
+ {{ log.priorityName }} - {{ log.message|format_log_message(log.context) }}
{% endfor %}
diff --git a/src/Symfony/Component/VarDumper/Caster/ClassStub.php b/src/Symfony/Component/VarDumper/Caster/ClassStub.php
index 263a6cf96f5fe..59efecda9ebe6 100644
--- a/src/Symfony/Component/VarDumper/Caster/ClassStub.php
+++ b/src/Symfony/Component/VarDumper/Caster/ClassStub.php
@@ -64,7 +64,7 @@ public function __construct($identifier, $callable = null)
if ($f = $r->getFileName()) {
$this->attr['file'] = $f;
- $this->attr['line'] = $r->getStartLine() - substr_count($r->getDocComment(), "\n");
+ $this->attr['line'] = $r->getStartLine();
}
}
diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php
index 0fe96d39e38f0..e2953dd723234 100644
--- a/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php
@@ -119,7 +119,7 @@ public function testClassStub()
$expectedDump = <<<'EODUMP'
array:1 [
- 0 => "hello"
+ 0 => "hello"
]
EODUMP;
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy