From 245af35a6050479004bc00dd3d1bdb34798a8bd5 Mon Sep 17 00:00:00 2001 From: triatic <42704418+triatic@users.noreply.github.com> Date: Sun, 6 Jan 2019 19:30:02 +0000 Subject: [PATCH] [contents] improve file_get_contents() reporting (#986) Suppress any errors from file_get_contents() and include the PHP error in the feed instead. --- lib/contents.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/contents.php b/lib/contents.php index 9d4ca2fa..dc0ca517 100644 --- a/lib/contents.php +++ b/lib/contents.php @@ -54,7 +54,7 @@ function getContents($url, $header = array(), $opts = array()){ // Use file_get_contents if in CLI mode with no root certificates defined if(php_sapi_name() === 'cli' && empty(ini_get('curl.cainfo'))) { - $data = file_get_contents($url); + $data = @file_get_contents($url); if($data === false) { $errorCode = 500; @@ -167,10 +167,14 @@ EOD ); } + $lastError = error_get_last(); + if($lastError !== null) + $lastError = $lastError['message']; returnError(<<