10000 [TwigBundle] Fixing regression in TwigEngine exception handling by attila901 · Pull Request #21179 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBundle] Fixing regression in TwigEngine exception handling #21179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixing regression in TwigEngine exception handling.
  • Loading branch information
Bertalan Attila committed Jan 9, 2017
commit 390cb335fab2854407eb2a13f53d067b3a8f6915
6 changes: 3 additions & 3 deletions src/Symfony/Bundle/TwigBundle/TwigEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public function render($name, array $parameters = array())
if ($name instanceof TemplateReference) {
try {
// try to get the real name of the template where the error occurred
$name = $e->getTemplateName();
$path = (string) $this->locator->locate($this->parser->parse($name));
if (method_exists($e, 'setSourceContext')) {
$e->setSourceContext(new \Twig_Source('', $name, $path));
$e->setSourceContext($e->getSourceContext());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even better: do nothing in this case, as it is a no-op now

} else {
$templateName = $e->getTemplateName();
$path = (string) $this->locator->locate($this->parser->parse($templateName));
$e->setTemplateName($path);
}
} catch (\Exception $e2) {
Expand Down
0