Commit 44fd52ce authored by deviantintegral's avatar deviantintegral
Browse files

Add a reference to the kernel in ExceptionController.

parent 9152debf
......@@ -67,6 +67,6 @@ public function __construct(EventDispatcherInterface $dispatcher, ControllerReso
// Either way, treat it as a server-level error and return an HTTP 500.
// By default, this will be an HTML-type response because that's a decent
// best guess if we don't know otherwise.
$this->dispatcher->addSubscriber(new ExceptionListener(array(new ExceptionController($negotiation), 'execute')));
$this->dispatcher->addSubscriber(new ExceptionListener(array(new ExceptionController($this, $negotiation), 'execute')));
}
}
......@@ -7,6 +7,8 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Exception;
......@@ -17,9 +19,11 @@
*/
class ExceptionController {
protected $kernel;
protected $negotiation;
public function __construct(ContentNegotiation $negotiation) {
public function __construct(HttpKernelInterface $kernel, ContentNegotiation $negotiation) {
$this->kernel = $kernel;
$this->negotiation = $negotiation;
}
......@@ -73,10 +77,9 @@ public function on404Html(FlattenException $exception, Request $request) {
if ($path && $path != $system_path) {
// @TODO: Um, how do I specify an override URL again? Totally not clear.
// Do that and sub-call the kernel rather than using meah().
$request = Request::create($path);
$subrequest = Request::create('/' . $path, 'get', array(), $request->cookies->all(), array(), $request->server->all());
$kernel = new DrupalKernel();
$response = $kernel->handle($request, HttpKernelInterface::SUB_REQUEST);
$response = $this->kernel->handle($subrequest, HttpKernelInterface::SUB_REQUEST);
$response->setStatusCode(404, 'Not Found');
}
else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment