Skip to content

Commit 9c5c3b6

Browse files
author
Ibrahim BinAlshikh
committed
fix: remove silent try-catch in StartSessionMiddleware::after()
The empty catch(Error) block silently swallowed all errors, hiding the static call bug fixed in #297. Errors in middleware should propagate rather than be silently ignored. Fixes #298
1 parent 907984c commit 9c5c3b6

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

WebFiori/Framework/Middleware/StartSessionMiddleware.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace WebFiori\Framework\Middleware;
44

5-
use Error;
65
use WebFiori\Framework\Session\SessionsManager;
76
use WebFiori\Http\Request;
87
use WebFiori\Http\Response;
@@ -21,15 +20,12 @@ public function __construct() {
2120
$this->setPriority(PHP_INT_MAX);
2221
$this->addToGroup('web');
2322
}
24-
public function after(Request $request, Response $response) {
25-
try {
26-
$sessionsCookiesHeaders = SessionsManager::getCookiesHeaders();
27-
28-
foreach ($sessionsCookiesHeaders as $headerVal) {
29-
$response->addHeader('set-cookie', $headerVal);
30-
}
31-
} catch (Error $exc) {
32-
}
23+
public function after(Request $request, Response $response) {
24+
$sessionsCookiesHeaders = SessionsManager::getCookiesHeaders();
25+
26+
foreach ($sessionsCookiesHeaders as $headerVal) {
27+
$response->addHeader('set-cookie', $headerVal);
28+
}
3329
}
3430

3531
public function afterSend(Request $request, Response $response) {

0 commit comments

Comments
 (0)