Skip to content

Commit 83f6032

Browse files
authored
Merge pull request #284 from xiaohutai/4.2
Fix flash messages again -- See #283 [EXPERIMENTAL]
2 parents c435dfc + 8ffaad2 commit 83f6032

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

src/Submission/Handler/Redirect.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,25 @@ public function __construct(RedirectableUrlMatcher $urlMatcher)
5353
*
5454
* @param FormConfig $formConfig
5555
* @param Entity $formData
56-
* @return RedirectResponse
5756
*/
5857
public function handle(FormConfig $formConfig, Entity $formData)
5958
{
6059
$response = $this->getRedirectResponse($formConfig, $formData);
6160
if ($response instanceof RedirectResponse) {
62-
return $response->send();
61+
$response->send();
6362
}
6463
}
6564

6665
/**
6766
* Refresh the current page.
6867
*
6968
* @param Request $request
70-
* @return RedirectResponse
7169
*/
7270
public function refresh(Request $request)
7371
{
7472
$response = new RedirectResponse($request->getRequestUri());
7573

76-
return $response->send();
74+
$response->send();
7775
}
7876

7977
/**

src/Submission/Processor/Redirect.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,17 @@ public function process(LifecycleEvent $lifeEvent, $eventName, EventDispatcherIn
7878
/** @var Handler\Redirect $handler */
7979
$handler = $this->handlers['redirect'];
8080
if ($formConfig->getFeedback()->getRedirectTarget() !== null) {
81-
$response = $handler->handle($formConfig, $formData);
82-
if ($response instanceof RedirectResponse) {
83-
return;
84-
}
81+
$handler->handle($formConfig, $formData);
8582
}
8683

8784
// Do a get on the page as it was probably POSTed
8885
$request = $this->requestStack->getCurrentRequest();
8986

90-
$response = $handler->refresh($request);
91-
if ($response instanceof RedirectResponse) {
92-
return;
93-
}
87+
$handler->refresh($request);
9488

95-
throw new HttpException(Response::HTTP_FOUND, '', null, []);
89+
// Just 'exit'-ing is bad practice, but in this case it prevents an oscure error.
90+
// @see https://github.com/bolt/boltforms/pull/284 for details
91+
exit;
92+
// throw new HttpException(Response::HTTP_FOUND, '', null, []);
9693
}
9794
}

0 commit comments

Comments
 (0)