From 0f1396f2a53f4368f1f2dcddf8ebfbf82d3cbc03 Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 5 Dec 2024 07:10:48 +0000 Subject: [PATCH 1/2] Don't save and process empty files --- application/controllers/Qrz.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index f506a660a..9bbcef643 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -370,8 +370,8 @@ class Qrz extends CI_Controller { curl_setopt( $ch, CURLOPT_USERAGENT, 'Wavelog/'.$this->optionslib->get_option('version')); $content = htmlspecialchars_decode(curl_exec($ch)); - file_put_contents($file, $content); - if (strlen(file_get_contents($file, false, null, 0, 100))!=100) { + if (strlen($content)<100) { + file_put_contents($file, $content); $result = "QRZ downloading failed, either due to it being down or incorrect logins."; return "false"; } From 31e9c8c7af5bfad129147426cce56ea57ccb8ba6 Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 5 Dec 2024 07:20:52 +0000 Subject: [PATCH 2/2] file_put needs to be outside the if (tnx fer hint DF2ET) --- application/controllers/Qrz.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index 9bbcef643..2fbb87777 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -371,10 +371,10 @@ class Qrz extends CI_Controller { $content = htmlspecialchars_decode(curl_exec($ch)); if (strlen($content)<100) { - file_put_contents($file, $content); $result = "QRZ downloading failed, either due to it being down or incorrect logins."; return "false"; } + file_put_contents($file, $content); ini_set('memory_limit', '-1'); $result = $this->loadFromFile($file, $station_ids);