Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Fix EZP-26083: handle change of behaviour in Twig's ExceptionController #679

Merged
merged 1 commit into from
Sep 23, 2016
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
11 changes: 9 additions & 2 deletions Controller/ExceptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Symfony\Bundle\TwigBundle\Controller\ExceptionController as BaseExceptionController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Templating\TemplateReferenceInterface;

class ExceptionController extends BaseExceptionController
{
Expand All @@ -22,8 +23,14 @@ protected function findTemplate(Request $request, $format, $code, $showException
return $template;
}

$customTemplate = clone $template;
$customTemplate->set('bundle', 'eZPlatformUIBundle');
// pre Symfony 2.8 compatibility
if ($template instanceof TemplateReferenceInterface) {
$customTemplate = clone $template;
$customTemplate->set('bundle', 'eZPlatformUIBundle');
} else {
$customTemplate = str_replace('@Twig', '@eZPlatformUIBundle', $template);
}

if ($this->templateExists($customTemplate)) {
return $customTemplate;
}
Expand Down