summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-04-19 18:13:21 +0400
committerAndrew Dolgov <[email protected]>2013-04-19 18:13:21 +0400
commit6122c449abae6d6dfa5372580242b4abdf4d7a97 (patch)
treee8a5e63e26917095b02d088cfb2df0258e70c0f2
parent01311d86fea8788c596d46e72073dc3c7e610b76 (diff)
correctly report fetch error
-rw-r--r--include/functions.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php
index 615f0a9b7..e861193c2 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -402,6 +402,8 @@
$context = NULL;
}
+ $old_error = error_get_last();
+
$data = @file_get_contents($url, false, $context);
$fetch_last_content_type = false; // reset if no type was sent from server
@@ -419,9 +421,14 @@
}
}
- if (!$data && function_exists('error_get_last')) {
+ if (!$data) {
$error = error_get_last();
- $fetch_last_error = $error["message"];
+
+ if ($error['message'] != $old_error['message']) {
+ $fetch_last_error = $error["message"];
+ } else {
+ $fetch_last_error = "HTTP Code: $fetch_last_error_code";
+ }
}
return $data;
}