Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit ad01dbf

Browse files
committed
Merge branch 'hotfix/151' into release-2.7
Close #151
2 parents e455f1c + 6fe6347 commit ad01dbf

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/MiddlewareListener.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@ public function onDispatch(MvcEvent $event)
6060
$caughtException = null;
6161
try {
6262
$return = $middleware(Psr7Request::fromZend($request), Psr7Response::fromZend($response));
63-
} catch (\Throwable $exception) {
64-
$caughtException = $exception;
65-
} catch (\Exception $exception) { // @TODO clean up once PHP 7 requirement is enforced
66-
$caughtException = $exception;
63+
} catch (\Throwable $ex) {
64+
$caughtException = $ex;
65+
} catch (\Exception $ex) { // @TODO clean up once PHP 7 requirement is enforced
66+
$caughtException = $ex;
6767
}
6868

6969
if ($caughtException !== null) {
7070
$event->setName(MvcEvent::EVENT_DISPATCH_ERROR);
7171
$event->setError($application::ERROR_EXCEPTION);
7272
$event->setController($middlewareName);
7373
$event->setControllerClass(get_class($middleware));
74-
$event->setParam('exception', $exception);
74+
$event->setParam('exception', $caughtException);
7575

7676
$events = $application->getEventManager();
7777
$results = $events->triggerEvent($event);

src/View/Http/DefaultRenderingStrategy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ public function render(MvcEvent $e)
111111

112112
if ($caughtException !== null) {
113113
if ($e->getName() === MvcEvent::EVENT_RENDER_ERROR) {
114-
throw $ex;
114+
throw $caughtException;
115115
}
116116

117117
$application = $e->getApplication();
118118
$events = $application->getEventManager();
119119

120120
$e->setError(Application::ERROR_EXCEPTION);
121-
$e->setParam('exception', $ex);
121+
$e->setParam('exception', $caughtException);
122122
$e->setName(MvcEvent::EVENT_RENDER_ERROR);
123123
$events->triggerEvent($e);
124124
}

0 commit comments

Comments
 (0)