Skip to content

Commit

Permalink
bug #27396 [HttpKernel] fix registering IDE links (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] fix registering IDE links

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #27194
| License       | MIT
| Doc PR        | -

Reverts some changes made in #27074 in `FrameworkBundle::boot()` that create the linked issue. Leverages changes done in #26138 instead.

Commits
-------

92e3023 [HttpKernel] fix registering IDE links
  • Loading branch information
nicolas-grekas committed May 29, 2018
2 parents 6fc7fdb + 92e3023 commit 31c7db9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<argument type="service" id="logger" on-invalid="null" />
<argument>%kernel.debug%</argument>
<argument>%kernel.charset%</argument>
<argument>%debug.file_link_format%</argument>
</service>

<service id="validate_request_listener" class="Symfony\Component\HttpKernel\EventListener\ValidateRequestListener">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -123,7 +125,7 @@ protected function duplicateRequest(\Exception $exception, Request $request)
$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());
},
Expand Down

0 comments on commit 31c7db9

Please sign in to comment.