Skip to content

Commit

Permalink
Merge pull request #4 from codex-team/fix/issue-with-missing-current-…
Browse files Browse the repository at this point in the history
…request-in-console-commands

Fix: Issue with missing current request in console commands
  • Loading branch information
pavelzotikov authored Sep 25, 2024
2 parents 48cc957 + 5667927 commit e110546
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Symfony errors Catcher module for Hawk.so",
"keywords": ["hawk", "php", "error", "catcher", "monolog", "symfony"],
"type": "library",
"version": "0.0.3",
"version": "0.0.4",
"license": "MIT",
"require": {
"php": "^7.2 || ^8.0",
Expand Down
10 changes: 7 additions & 3 deletions src/Monolog/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,20 @@ public function doWrite($record): void

private function collectRequestInfo(): array
{
$currentRequest = $this->request->getCurrentRequest();

if ($currentRequest === null) {
return [];
}

$factory = new PsrHttpFactory(
Psr17FactoryDiscovery::findServerRequestFactory(),
Psr17FactoryDiscovery::findStreamFactory(),
Psr17FactoryDiscovery::findUploadedFileFactory(),
Psr17FactoryDiscovery::findResponseFactory()
);

$request = $factory->createRequest(
$this->request->getCurrentRequest()
);
$request = $factory->createRequest($currentRequest);

return [
'method' => $request->getMethod(),
Expand Down

0 comments on commit e110546

Please sign in to comment.