HTTPClient would return null instead of exception

This caused $response->isOK() tests to call a function on a non-existing object, causing all hell to break loose.
This commit is contained in:
Mikael Nordfeldth
2016-01-11 02:36:59 +01:00
parent 87ae5292b8
commit b13f8df79b
4 changed files with 26 additions and 10 deletions

View File

@@ -58,9 +58,14 @@ class DiscoveryHints {
{
$client = new HTTPClient();
$client->setHeader('Accept', 'text/html,application/xhtml+xml');
$response = $client->get($url);
try {
$response = $client->get($url);
if (!$response->isOk()) {
if (!$response->isOk()) {
return null;
}
} catch (HTTP_Request2_Exception $e) {
// Any HTTPClient error that might've been thrown
return null;
}