Skip to content

Commit 1a6a4b2

Browse files
committed
Fixed response code of errors.
1 parent 3c89ff2 commit 1a6a4b2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
"symfony/http-foundation": "^5.4.0"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^8.5 || ^9.4",
26-
"guzzlehttp/guzzle": "^7.2"
25+
"phpunit/phpunit": "^8.5 || ^9.4"
2726
},
2827
"autoload": {
2928
"psr-4": {

src/Router.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
class Router
4141
{
4242
/** Router Version */
43-
const VERSION = '2.5.0';
43+
const VERSION = '2.5.2';
4444

4545
/** @var string $baseFolder Base folder of the project */
4646
protected $baseFolder;
@@ -320,10 +320,11 @@ public function run(): void
320320
);
321321
}
322322
} catch (Exception $e) {
323-
$this->response()->setStatusCode(Response::HTTP_INTERNAL_SERVER_ERROR);
324323
if ($this->debug) {
324+
http_response_code(Response::HTTP_INTERNAL_SERVER_ERROR);
325325
die("Fatal error: Uncaught {$e}");
326326
}
327+
$this->response()->setStatusCode(Response::HTTP_INTERNAL_SERVER_ERROR);
327328
$this->routerCommand()->sendResponse(
328329
call_user_func($this->errorCallback, $this->request(), $this->response(), $e)
329330
);

0 commit comments

Comments
 (0)