Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.

Commit c3c435b

Browse files
Merge pull request #1441 from Scheirle/ispdb_timeout
Adds a timeout to the ispdb autoconfig query.
2 parents edeca8a + 0ae83db commit c3c435b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lib/service/autoconfig/ispdb.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,19 @@ public function __construct(Logger $logger) {
4848

4949
private function queryUrl($url) {
5050
try {
51-
$xml = @simplexml_load_file($url);
52-
if (libxml_get_last_error() !== False || !is_object($xml) || !$xml->emailProvider) {
51+
$content = @file_get_contents($url, false, stream_context_create([
52+
'http' => [
53+
'timeout' => 7
54+
]
55+
]));
56+
if ($content !== false) {
57+
$xml = @simplexml_load_string($content);
58+
} else {
59+
$this->logger->debug("IsbDb: <$url> request timed out");
60+
return [];
61+
}
62+
63+
if (libxml_get_last_error() !== false || !is_object($xml) || !$xml->emailProvider) {
5364
libxml_clear_errors();
5465
return [];
5566
}

0 commit comments

Comments
 (0)