<p dir="auto"><strong>Symfony version(s) affected</strong>: 4.1</p>
<p dir="auto"><strong>Description</strong><br>
When i try to access in security page, i have an exception critical in my log, this error critical don't exist in 4.0.x<br>
Trace :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AccessDeniedException: &quot;Access Denied.&quot; at /var/www/demo-master/vendor/symfony/security/Http/Firewall/AccessListener.php line 68
Hide context    Hide trace
[▼
  &quot;exception&quot; =&gt; AccessDeniedException {#316 ▶}
]
{▼
  /var/www/demo-master/vendor/symfony/security/Http/Firewall/AccessListener.php:68 {▶}
  /var/www/demo-master/vendor/symfony/security-bundle/Debug/WrappedListener.php:46 {▶}
  /var/www/demo-master/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php:35 {▶}
  /var/www/demo-master/vendor/symfony/security/Http/Firewall.php:61 {▶}
  /var/www/demo-master/vendor/symfony/security-bundle/EventListener/FirewallListener.php:48 {▶}
  Symfony\Bundle\SecurityBundle\EventListener\FirewallListener-&gt;onKernelRequest() {}
  /var/www/demo-master/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104 {▶}
  /var/www/demo-master/vendor/symfony/event-dispatcher/EventDispatcher.php:212 {▶}
  /var/www/demo-master/vendor/symfony/event-dispatcher/EventDispatcher.php:44 {▶}
  /var/www/demo-master/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:141 {▶}
  /var/www/demo-master/vendor/symfony/http-kernel/HttpKernel.php:125 {▶}
  /var/www/demo-master/vendor/symfony/http-kernel/HttpKernel.php:66 {▶}
  /var/www/demo-master/vendor/symfony/http-kernel/Kernel.php:188 {▶}
  /var/www/demo-master/public/index.php:37 {▼
    › $request = Request::createFromGlobals();
    › $response = $kernel-&gt;handle($request);
    › $response-&gt;send();
    arguments: {▶}
  }
}"><pre class="notranslate"><code class="notranslate">Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AccessDeniedException: "Access Denied." at /var/www/demo-master/vendor/symfony/security/Http/Firewall/AccessListener.php line 68
Hide context    Hide trace
[▼
  "exception" =&gt; AccessDeniedException {#316 ▶}
]
{▼
  /var/www/demo-master/vendor/symfony/security/Http/Firewall/AccessListener.php:68 {▶}
  /var/www/demo-master/vendor/symfony/security-bundle/Debug/WrappedListener.php:46 {▶}
  /var/www/demo-master/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php:35 {▶}
  /var/www/demo-master/vendor/symfony/security/Http/Firewall.php:61 {▶}
  /var/www/demo-master/vendor/symfony/security-bundle/EventListener/FirewallListener.php:48 {▶}
  Symfony\Bundle\SecurityBundle\EventListener\FirewallListener-&gt;onKernelRequest() {}
  /var/www/demo-master/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104 {▶}
  /var/www/demo-master/vendor/symfony/event-dispatcher/EventDispatcher.php:212 {▶}
  /var/www/demo-master/vendor/symfony/event-dispatcher/EventDispatcher.php:44 {▶}
  /var/www/demo-master/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:141 {▶}
  /var/www/demo-master/vendor/symfony/http-kernel/HttpKernel.php:125 {▶}
  /var/www/demo-master/vendor/symfony/http-kernel/HttpKernel.php:66 {▶}
  /var/www/demo-master/vendor/symfony/http-kernel/Kernel.php:188 {▶}
  /var/www/demo-master/public/index.php:37 {▼
    › $request = Request::createFromGlobals();
    › $response = $kernel-&gt;handle($request);
    › $response-&gt;send();
    arguments: {▶}
  }
}
</code></pre></div>
<p dir="auto"><strong>How to reproduce</strong><br>
Just clone symfony-demo and try to access in <a href="http://127.0.0.1:8000/fr/admin/post/" rel="nofollow">http://127.0.0.1:8000/fr/admin/post/</a><br>
go to the profiler and select the page 302 (@admin_index) you can see an exception &amp; error critical in log.</p>
<p dir="auto">If i downgrade in 4.0.x, i don't have this critical error.</p>
<p dir="auto"><strong>Possible Solution</strong><br>
For me access denied is not critical</p>
<p dir="auto"><strong>Symfony version(s) affected</strong>: 4.0.9/4.1.0-BETA1</p>
<p dir="auto"><strong>Description</strong><br>
Commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/symfony/symfony/commit/4e527aa790f41e18a82cb9c53e782549fb564802/hovercard" href="https://github.com/symfony/symfony/commit/4e527aa790f41e18a82cb9c53e782549fb564802"><tt>4e527aa</tt></a> added a service <code class="notranslate">http_exception_listener</code>. This registers a system-wide exception handler that sets request's <code class="notranslate">_controller</code> attribute to a closure during <code class="notranslate">kernel.exception</code>.<br>
Also this closure controller generates a response on the event. As a consequence of that, this triggers listeners on <code class="notranslate">kernel.response</code> event - with <code class="notranslate">_controller</code> as a closure instead of previously not being invoked at all, and the generated response instead of null.</p>
<p dir="auto"><strong>How to reproduce</strong><br>
Failing test case provided separately in  <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="321662513" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/27213" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/27213/hovercard" href="https://github.com/symfony/symfony/pull/27213">#27213</a>.</p>
<p dir="auto"><strong>Additional context</strong><br>
Encountered in API-only application, no templating etc., only custom request/response handling and custom exception handling.</p>