aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorDavid King <imkingdavid@gmail.com>2012-11-19 12:37:20 -0500
committerDavid King <imkingdavid@gmail.com>2012-11-19 12:37:20 -0500
commitf8614bfc84ba9b9cc814b8f78e343005620f18f8 (patch)
tree2bc656eecad6052aa04134c4506ab10876d6fe63 /phpBB
parent30043502814cd42d824dc1d6bcb25bebc60adbed (diff)
downloadforums-f8614bfc84ba9b9cc814b8f78e343005620f18f8.tar
forums-f8614bfc84ba9b9cc814b8f78e343005620f18f8.tar.gz
forums-f8614bfc84ba9b9cc814b8f78e343005620f18f8.tar.bz2
forums-f8614bfc84ba9b9cc814b8f78e343005620f18f8.tar.xz
forums-f8614bfc84ba9b9cc814b8f78e343005620f18f8.zip
[feature/controller] Check for proper status codes from controllers
PHPBB3-10864
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/app.php7
-rw-r--r--phpBB/includes/event/kernel_exception_subscriber.php9
2 files changed, 8 insertions, 8 deletions
diff --git a/phpBB/app.php b/phpBB/app.php
index c085f966c8..d93208d585 100644
--- a/phpBB/app.php
+++ b/phpBB/app.php
@@ -24,12 +24,7 @@ $user->session_begin();
$auth->acl($user->data);
$user->setup('app');
-// Until we fix the issue with relative paths, we have to fake path info to
-// allow urls like app.php?controller=foo/bar
-$controller = $request->variable('controller', '');
-$uri = '/' . $controller;
-$symfony_request = phpbb_create_symfony_request($uri, $request);
-
+$symfony_request = phpbb_create_symfony_request($request);
$http_kernel = $phpbb_container->get('http_kernel');
$response = $http_kernel->handle($symfony_request);
$response->send();
diff --git a/phpBB/includes/event/kernel_exception_subscriber.php b/phpBB/includes/event/kernel_exception_subscriber.php
index e2668d4560..e843df2e68 100644
--- a/phpBB/includes/event/kernel_exception_subscriber.php
+++ b/phpBB/includes/event/kernel_exception_subscriber.php
@@ -18,6 +18,7 @@ if (!defined('IN_PHPBB'))
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\Response;
class phpbb_event_kernel_exception_subscriber implements EventSubscriberInterface
@@ -56,9 +57,11 @@ class phpbb_event_kernel_exception_subscriber implements EventSubscriberInterfac
{
page_header($this->user->lang('INFORMATION'));
+ $exception = $event->getException();
+
$this->template->assign_vars(array(
'MESSAGE_TITLE' => $this->user->lang('INFORMATION'),
- 'MESSAGE_TEXT' => $event->getException()->getMessage(),
+ 'MESSAGE_TEXT' => $exception->getMessage(),
));
$this->template->set_filenames(array(
@@ -67,7 +70,9 @@ class phpbb_event_kernel_exception_subscriber implements EventSubscriberInterfac
page_footer(true, false, false);
- $response = new Response($this->template->assign_display('body'), 404);
+
+ $status_code = $exception instanceof NotFoundHttpException ? $exception->getStatusCode() : 500;
+ $response = new Response($this->template->assign_display('body'), $status_code);
$event->setResponse($response);
}