Skip to content

Commit e110546

Browse files
authored
Merge pull request #4 from codex-team/fix/issue-with-missing-current-request-in-console-commands
Fix: Issue with missing current request in console commands
2 parents 48cc957 + 5667927 commit e110546

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Symfony errors Catcher module for Hawk.so",
44
"keywords": ["hawk", "php", "error", "catcher", "monolog", "symfony"],
55
"type": "library",
6-
"version": "0.0.3",
6+
"version": "0.0.4",
77
"license": "MIT",
88
"require": {
99
"php": "^7.2 || ^8.0",

src/Monolog/Handler.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,20 @@ public function doWrite($record): void
4545

4646
private function collectRequestInfo(): array
4747
{
48+
$currentRequest = $this->request->getCurrentRequest();
49+
50+
if ($currentRequest === null) {
51+
return [];
52+
}
53+
4854
$factory = new PsrHttpFactory(
4955
Psr17FactoryDiscovery::findServerRequestFactory(),
5056
Psr17FactoryDiscovery::findStreamFactory(),
5157
Psr17FactoryDiscovery::findUploadedFileFactory(),
5258
Psr17FactoryDiscovery::findResponseFactory()
5359
);
5460

55-
$request = $factory->createRequest(
56-
$this->request->getCurrentRequest()
57-
);
61+
$request = $factory->createRequest($currentRequest);
5862

5963
return [
6064
'method' => $request->getMethod(),

0 commit comments

Comments
 (0)