From fc01d79cfb061ca6906bd5e915af620e4367e854 Mon Sep 17 00:00:00 2001 From: Pavel Zotikov Date: Wed, 25 Sep 2024 18:37:21 +0300 Subject: [PATCH 1/2] Fix: Issue with missing current request in console commands --- src/Monolog/Handler.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Monolog/Handler.php b/src/Monolog/Handler.php index b9f531f..80e22d0 100644 --- a/src/Monolog/Handler.php +++ b/src/Monolog/Handler.php @@ -45,6 +45,12 @@ public function doWrite($record): void private function collectRequestInfo(): array { + $currentRequest = $this->request->getCurrentRequest(); + + if ($currentRequest === null) { + return []; + } + $factory = new PsrHttpFactory( Psr17FactoryDiscovery::findServerRequestFactory(), Psr17FactoryDiscovery::findStreamFactory(), @@ -52,9 +58,7 @@ private function collectRequestInfo(): array Psr17FactoryDiscovery::findResponseFactory() ); - $request = $factory->createRequest( - $this->request->getCurrentRequest() - ); + $request = $factory->createRequest($currentRequest); return [ 'method' => $request->getMethod(), From 566792783690cc95c48e05b527e7032683573b8b Mon Sep 17 00:00:00 2001 From: Pavel Zotikov Date: Wed, 25 Sep 2024 18:39:13 +0300 Subject: [PATCH 2/2] update version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index de78f50..da2b127 100644 --- a/composer.json +++ b/composer.json @@ -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",