From 92e3023195e4afeed0568a4e94adf2dc2453aa1a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 28 May 2018 17:16:05 +0200 Subject: [PATCH] [HttpKernel] fix registering IDE links --- src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php | 3 --- src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml | 1 + .../WebProfilerBundle/Controller/ExceptionController.php | 1 + .../HttpKernel/EventListener/ExceptionListener.php | 6 ++++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php index 17c12686da..2a62d391a7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php @@ -61,9 +61,6 @@ class FrameworkBundle extends Bundle { public function boot() { - if (!ini_get('xdebug.file_link_format') && !get_cfg_var('xdebug.file_link_format')) { - ini_set('xdebug.file_link_format', $this->container->getParameter('debug.file_link_format')); - } ErrorHandler::register(null, false)->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true); if ($this->container->hasParameter('kernel.trusted_proxies')) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml index 565aef68fd..f6dd2bb9df 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml @@ -74,6 +74,7 @@ %kernel.debug% %kernel.charset% + %debug.file_link_format% diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php index f008b0b528..2137477a5c 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php @@ -30,6 +30,7 @@ class ExceptionController protected $twig; protected $debug; protected $profiler; + private $fileLinkFormat; public function __construct(Profiler $profiler = null, Environment $twig, $debug, FileLinkFormatter $fileLinkFormat = null) { diff --git a/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php b/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php index 3dfa4cd8ea..4d8ad1e7e5 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php @@ -36,13 +36,15 @@ class ExceptionListener implements EventSubscriberInterface protected $logger; protected $debug; private $charset; + private $fileLinkFormat; - public function __construct($controller, LoggerInterface $logger = null, $debug = false, $charset = null) + public function __construct($controller, LoggerInterface $logger = null, $debug = false, $charset = null, $fileLinkFormat = null) { $this->controller = $controller; $this->logger = $logger; $this->debug = $debug; $this->charset = $charset; + $this->fileLinkFormat = $fileLinkFormat; } public function onKernelException(GetResponseForExceptionEvent $event) @@ -123,7 +125,7 @@ class ExceptionListener implements EventSubscriberInterface $attributes = array( 'exception' => $exception = FlattenException::create($exception), '_controller' => $this->controller ?: function () use ($exception) { - $handler = new ExceptionHandler($this->debug, $this->charset); + $handler = new ExceptionHandler($this->debug, $this->charset, $this->fileLinkFormat); return new Response($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders()); },