Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 50c4384

Browse filesBrowse files
Merge branch '4.1'
* 4.1: Revert "bug #26138 [HttpKernel] Catch HttpExceptions when templating is not installed (cilefen)"
2 parents 8ec22e5 + 72f7ac0 commit 50c4384
Copy full SHA for 50c4384

File tree

4 files changed

+7
-46
lines changed
Filter options

4 files changed

+7
-46
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml
-10Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,6 @@
6767
<argument type="service" id="router" on-invalid="ignore" />
6868
</service>
6969

70-
<service id="http_exception_listener" class="Symfony\Component\HttpKernel\EventListener\ExceptionListener">
71-
<tag name="kernel.event_listener" event="kernel.exception" method="onKernelException" priority="-256"/>
72-
<tag name="monolog.logger" channel="request" />
73-
<argument>null</argument>
74-
<argument type="service" id="logger" on-invalid="null" />
75-
<argument>%kernel.debug%</argument>
76-
<argument>%kernel.charset%</argument>
77-
<argument>%debug.file_link_format%</argument>
78-
</service>
79-
8070
<service id="validate_request_listener" class="Symfony\Component\HttpKernel\EventListener\ValidateRequestListener">
8171
<tag name="kernel.event_subscriber" />
8272
</service>

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/MissingUserProviderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/MissingUserProviderTest.php
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
class MissingUserProviderTest extends WebTestCase
1717
{
18+
/**
19+
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
20+
* @expectedExceptionMessage "default" firewall requires a user provider but none was defined.
21+
*/
1822
public function testUserProviderIsNeeded()
1923
{
2024
$client = $this->createClient(array('test_case' => 'MissingUserProvider', 'root_config' => 'config.yml'));
@@ -23,11 +27,5 @@ public function testUserProviderIsNeeded()
2327
'PHP_AUTH_USER' => 'username',
2428
'PHP_AUTH_PW' => 'pa$$word',
2529
));
26-
27-
$response = $client->getResponse();
28-
29-
$this->assertSame(500, $response->getStatusCode());
30-
$this->assertContains(InvalidConfigurationException::class, $response->getContent());
31-
$this->assertContains('"default" firewall requires a user provider but none was defined', htmlspecialchars_decode($response->getContent()));
3230
}
3331
}

‎src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php
+3-13Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
namespace Symfony\Component\HttpKernel\EventListener;
1313

1414
use Psr\Log\LoggerInterface;
15-
use Symfony\Component\Debug\ExceptionHandler;
1615
use Symfony\Component\Debug\Exception\FlattenException;
1716
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
1817
use Symfony\Component\HttpFoundation\Request;
19-
use Symfony\Component\HttpFoundation\Response;
2018
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
2119
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
2220
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
@@ -35,16 +33,12 @@ class ExceptionListener implements EventSubscriberInterface
3533
protected $controller;
3634
protected $logger;
3735
protected $debug;
38-
private $charset;
39-
private $fileLinkFormat;
4036

41-
public function __construct($controller, LoggerInterface $logger = null, $debug = false, $charset = null, $fileLinkFormat = null)
37+
public function __construct($controller, LoggerInterface $logger = null, $debug = false)
4238
{
4339
$this->controller = $controller;
4440
$this->logger = $logger;
4541
$this->debug = $debug;
46-
$this->charset = $charset;
47-
$this->fileLinkFormat = $fileLinkFormat;
4842
}
4943

5044
public function logKernelException(GetResponseForExceptionEvent $event)
@@ -130,12 +124,8 @@ protected function logException(\Exception $exception, $message)
130124
protected function duplicateRequest(\Exception $exception, Request $request)
131125
{
132126
$attributes = array(
133-
'exception' => $exception = FlattenException::create($exception),
134-
'_controller' => $this->controller ?: function () use ($exception) {
135-
$handler = new ExceptionHandler($this->debug, $this->charset, $this->fileLinkFormat);
136-
137-
return new Response($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders());
138-
},
127+
'_controller' => $this->controller,
128+
'exception' => FlattenException::create($exception),
139129
'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null,
140130
);
141131
$request = $request->duplicate(null, null, $attributes);

‎src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php
-17Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,23 +155,6 @@ public function testCSPHeaderIsRemoved()
155155
$this->assertFalse($response->headers->has('content-security-policy'), 'CSP header has been removed');
156156
$this->assertFalse($dispatcher->hasListeners(KernelEvents::RESPONSE), 'CSP removal listener has been removed');
157157
}
158-
159-
public function testNullController()
160-
{
161-
$listener = new ExceptionListener(null);
162-
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
163-
$kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
164-
$controller = $request->attributes->get('_controller');
165-
166-
return $controller();
167-
}));
168-
$request = Request::create('/');
169-
$event = new GetResponseForExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new \Exception('foo'));
170-
171-
$listener->onKernelException($event);
172-
173-
$this->assertContains('Whoops, looks like something went wrong.', $event->getResponse()->getContent());
174-
}
175158
}
176159

177160
class TestLogger extends Logger implements DebugLoggerInterface

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.