[GH-ISSUE #89] Problems with \Guzzle\Http\Exception\BadResponseException #30

Closed
opened 2026-03-04 02:11:30 +03:00 by kerem · 6 comments
Owner

Originally created by @mborho on GitHub (Jun 12, 2012).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/89

When logging the Exception via $logger->addCritical($e->getMessage(), $e->getTrace()) (within Symfony2) following happens:

Warning: get_class() expects parameter 1 to be object, resource given in /var/www/localhost/vendor/monolog/src/Monolog/Formatter/NormalizerFormatter.php line 79

When looking at the type of $data in normalize() it says "unknown type".

The Traceback of the Exception:

#0 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Message/Request.php(194): Guzzle\Http\Exception\BadResponseException::factory(Object(Guzzle\Http\Message\EntityEnclosingReque
st), Object(Guzzle\Http\Message\Response))
#1 [internal function]: Guzzle\Http\Message\Request::onRequestError(Object(Guzzle\Common\Event))
#2 /var/www/localhost/vendor/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(148): call_user_func(Array, Object(Guzzle\Common\Event))
#3 /var/www/localhost/vendor/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(49): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'request
.error', Object(Guzzle\Common\Event))
#4 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Message/Request.php(889): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('request.error', Object(Guzzle\Common\E
vent))
#5 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Message/Request.php(557): Guzzle\Http\Message\Request->processResponse()
#6 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Curl/CurlMulti.php(540): Guzzle\Http\Message\Request->setState('complete')
#7 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Curl/CurlMulti.php(410): Guzzle\Http\Curl\CurlMulti->processResponse(Object(Guzzle\Http\Message\EntityEnclosingRequest), Obje
ct(Guzzle\Http\Curl\CurlHandle), Array)
#8 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Curl/CurlMulti.php(292): Guzzle\Http\Curl\CurlMulti->perform()
#9 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Client.php(474): Guzzle\Http\Curl\CurlMulti->send()
#10 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Message/Request.php(286): Guzzle\Http\Client->send(Object(Guzzle\Http\Message\EntityEnclosingRequest))
Originally created by @mborho on GitHub (Jun 12, 2012). Original GitHub issue: https://github.com/Seldaek/monolog/issues/89 When logging the Exception via $logger->addCritical($e->getMessage(), $e->getTrace()) (within Symfony2) following happens: ``` php Warning: get_class() expects parameter 1 to be object, resource given in /var/www/localhost/vendor/monolog/src/Monolog/Formatter/NormalizerFormatter.php line 79 ``` When looking at the type of $data in normalize() it says "unknown type". The Traceback of the Exception: ``` php #0 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Message/Request.php(194): Guzzle\Http\Exception\BadResponseException::factory(Object(Guzzle\Http\Message\EntityEnclosingReque st), Object(Guzzle\Http\Message\Response)) #1 [internal function]: Guzzle\Http\Message\Request::onRequestError(Object(Guzzle\Common\Event)) #2 /var/www/localhost/vendor/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(148): call_user_func(Array, Object(Guzzle\Common\Event)) #3 /var/www/localhost/vendor/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(49): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'request .error', Object(Guzzle\Common\Event)) #4 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Message/Request.php(889): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('request.error', Object(Guzzle\Common\E vent)) #5 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Message/Request.php(557): Guzzle\Http\Message\Request->processResponse() #6 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Curl/CurlMulti.php(540): Guzzle\Http\Message\Request->setState('complete') #7 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Curl/CurlMulti.php(410): Guzzle\Http\Curl\CurlMulti->processResponse(Object(Guzzle\Http\Message\EntityEnclosingRequest), Obje ct(Guzzle\Http\Curl\CurlHandle), Array) #8 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Curl/CurlMulti.php(292): Guzzle\Http\Curl\CurlMulti->perform() #9 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Client.php(474): Guzzle\Http\Curl\CurlMulti->send() #10 /var/www/localhost/vendor/Guzzle/src/Guzzle/Http/Message/Request.php(286): Guzzle\Http\Client->send(Object(Guzzle\Http\Message\EntityEnclosingRequest)) ```
kerem closed this issue 2026-03-04 02:11:30 +03:00
Author
Owner

@Seldaek commented on GitHub (Jun 14, 2012):

Which version are you using? Because the latest code should cover against that so this is weird.

<!-- gh-comment-id:6338086 --> @Seldaek commented on GitHub (Jun 14, 2012): Which version are you using? Because the latest code should [cover against that](https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/NormalizerFormatter.php#L74) so this is weird.
Author
Owner

@mborho commented on GitHub (Jun 15, 2012):

It's the latest code and the resource is not recognized by "is_resource()".

Pretty weird, yes...

<!-- gh-comment-id:6358172 --> @mborho commented on GitHub (Jun 15, 2012): It's the latest code and the resource is not recognized by "is_resource()". Pretty weird, yes...
Author
Owner

@Seldaek commented on GitHub (Jun 15, 2012):

@mborho try with latest if you can. I pushed something that should fix it (see above). I'm curious to see what gettype outputs though.

<!-- gh-comment-id:6358376 --> @Seldaek commented on GitHub (Jun 15, 2012): @mborho try with latest if you can. I pushed something that should fix it (see above). I'm curious to see what gettype outputs though.
Author
Owner

@mborho commented on GitHub (Jun 15, 2012):

The initial warning happens no more, but now following warning appears:

Warning: json_encode(): type is unsupported, encoded as null in /var/www/localhost/vendor/monolog/src/Monolog/Formatter/WildfireFormatter.php line 73 (500 Int
ernal Server Error)
<!-- gh-comment-id:6360246 --> @mborho commented on GitHub (Jun 15, 2012): The initial warning happens no more, but now following warning appears: ``` php Warning: json_encode(): type is unsupported, encoded as null in /var/www/localhost/vendor/monolog/src/Monolog/Formatter/WildfireFormatter.php line 73 (500 Int ernal Server Error) ```
Author
Owner

@Seldaek commented on GitHub (Jun 15, 2012):

Ok, pushed another fix for the WildfireFormatter.. hopefully it's good now :)

<!-- gh-comment-id:6361302 --> @Seldaek commented on GitHub (Jun 15, 2012): Ok, pushed another fix for the WildfireFormatter.. hopefully it's good now :)
Author
Owner

@mborho commented on GitHub (Jun 18, 2012):

Thanks, now it works! :)

<!-- gh-comment-id:6389470 --> @mborho commented on GitHub (Jun 18, 2012): Thanks, now it works! :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#30
No description provided.