From 0f58f37b2ebc367313e6ad1be0a30ba36f2d04b0 Mon Sep 17 00:00:00 2001 From: AntonV1211 Date: Tue, 30 Jun 2026 15:46:23 +0700 Subject: [PATCH] Mod. SFW. Editing comments, editing sfw downloads, and personal lists --- Helper.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Helper.php b/Helper.php index 6369f1e..393d425 100644 --- a/Helper.php +++ b/Helper.php @@ -785,7 +785,7 @@ public static function httpGetDataFromRemoteGz($url) if ( $response_code === 200 ) { // Check if it's there $data = static::httpRequestGetContent($url); - if ( empty($data['error']) ) { + if ( is_string($data) ) { if ( static::getMimeType($data, 'application/x-gzip') ) { if ( function_exists('gzdecode') ) { $data = gzdecode($data); @@ -796,13 +796,14 @@ public static function httpGetDataFromRemoteGz($url) return array('error' => 'Can not unpack datafile'); } } else { - return array('error' => 'Function gzdecode not exists. Please update your PHP at least to version 5.4 ' . $data['error']); + return array('error' => 'Function gzdecode not exists. Please update your PHP at least to version 5.4'); } } else { return array('error' => 'Wrong file mime type: ' . $url); } } else { - return array('error' => 'Getting datafile ' . $url . '. Error: ' . $data['error']); + $error_msg = is_array($data) && !empty($data['error']) ? $data['error'] : 'Unknown error'; + return array('error' => 'Getting datafile ' . $url . '. Error: ' . $error_msg); } } else { return array('error' => 'Bad HTTP response (' . (int)$response_code . ') from file location: ' . $url); @@ -821,9 +822,11 @@ public static function httpGetDataFromRemoteGzAndParseCsv($url) { $result = static::httpGetDataFromRemoteGz($url); - return empty($result['error']) - ? static::bufferParseCsv($result) - : $result; + if ( is_string($result) ) { + return static::bufferParseCsv($result); + } + + return $result; } /**