summaryrefslogtreecommitdiff
path: root/lib/helper.php
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-07 15:40:56 +0100
committerErich Eckner <git@eckner.net>2019-02-07 15:40:56 +0100
commitbb46bd3f756f4e9901ab68a919d2641b681dd147 (patch)
treea0f915c095277b2468892ca61190e6a7fd6c990a /lib/helper.php
parente8a5ea6d47d6aaf85bd370252e7c9aa82d40865e (diff)
downloadarchweb32-bb46bd3f756f4e9901ab68a919d2641b681dd147.tar.xz
lib/helper.php: site_is_reachable(): give modified context instead of modifying default context
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/helper.php b/lib/helper.php
index 8296cd9..8c910ac 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -171,10 +171,8 @@ function if_unset($array, $index, $default) {
};
function site_is_reachable($url) {
- $scd = stream_context_get_default();
- stream_context_set_default(array('timeout' => 10));
- $headers = get_headers($url);
- stream_context_set_default($scd);
+ $stream_context = stream_context_create(array('timeout' => 10));
+ $headers = get_headers($url, 0, $stream_context);
if (is_array($headers))
foreach ($headers as $header) {
if (!(strpos($header, 'HTTP/') === 0))