]> git.wh0rd.org - tt-rss.git/commitdiff
correctly report fetch error
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 19 Apr 2013 14:13:21 +0000 (18:13 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 19 Apr 2013 14:13:21 +0000 (18:13 +0400)
include/functions.php

index 615f0a9b78aec5aa56d5d5b0cdf5c1eadc48d859..e861193c20aeacf3e5e187f429615d0813249182 100644 (file)
                                $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
                                }
                        }
 
-                       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;
                }