8p / EightPointsGuzzleBundle

⛽️ Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony
MIT License
440 stars 71 forks source link

Check context response existence before logging it #60

Closed MatthieuCutin closed 8 years ago

MatthieuCutin commented 8 years ago
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

Sometimes when i try to access a page, i get this error : Argument 1 passed to EightPoints\Bundle\GuzzleBundle\Log\LogResponse::__construct() must be an instance of Psr\Http\Message\ResponseInterface, null given, called in /path/to/bundle/GuzzleBundle/Log/Logger.php on line 44 Refreshing the page does not repeat the error (making it hard to reproduce).

I don't know why this append. I fixed it by checking not null $context['response'] but it might be interesting to look for root problem.

Does anyone have an idea ?

Thank you.

florianpreusner commented 8 years ago

I will check the response issue this afternoon.

florianpreusner commented 8 years ago

Hi @MatthieuCutin, thanks for your contribution and your time! Can you do the same for if (isset($context['request'])) {? Afterwards I will gladly merge your fix.

florianpreusner commented 8 years ago

Nice! Thanks a lot. Going to release a new version later.

MatthieuCutin commented 8 years ago

My pleasure :)

florianpreusner commented 8 years ago

Release 5.0.2: https://github.com/8p/GuzzleBundle/releases/tag/v5.0.2