From f1fa98deece7d8dc3dd5f56995e0bdd20b7cbe3e Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sun, 26 Nov 2023 10:30:23 +0300 Subject: [PATCH] Fixed void function result used (#1170) --- library/includes/file_list_v2.php | 3 ++- src/Legacy/Torrent.php | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/library/includes/file_list_v2.php b/library/includes/file_list_v2.php index c0759348c..d5d84fcf0 100644 --- a/library/includes/file_list_v2.php +++ b/library/includes/file_list_v2.php @@ -11,6 +11,7 @@ if (!defined('BB_ROOT')) { die(basename(__FILE__)); } +// Start session management $user->session_start(); if ($bb_cfg['bt_disable_dht'] && IS_GUEST) { @@ -58,7 +59,7 @@ if (isset($torrent['info']['private']) && IS_GUEST) { die($lang['BT_PRIVATE_TORRENT']); } -$files = (new TorrentPier\Legacy\TorrentFileList($torrent)) -> fileTreeTable($torrent['info']['file tree']); +$files = (new TorrentPier\Legacy\TorrentFileList($torrent))->fileTreeTable($torrent['info']['file tree']); $data = [ 'name' => isset($torrent['info']['name']) ? htmlCHR(substr($torrent['info']['name'], 0, 255)) : 'undefined', diff --git a/src/Legacy/Torrent.php b/src/Legacy/Torrent.php index acdf243d4..3ff44d61f 100644 --- a/src/Legacy/Torrent.php +++ b/src/Legacy/Torrent.php @@ -394,7 +394,11 @@ class Torrent foreach ($info['files'] as $fn => $f) { // Exclude padding files if (($f['attr'] ?? null) !== 'p') { - $totallen += (isset($f['length']) && is_numeric($f['length'])) ? $f['length'] : self::torrent_error_exit($lang['TORFILE_INVALID']); + if (isset($f['length']) && is_numeric($f['length'])) { + $totallen += $f['length']; + } else { + self::torrent_error_exit($lang['TORFILE_INVALID']); + } } } $totallen = (float)$totallen; @@ -407,7 +411,11 @@ class Torrent if (!isset($value[''])) { $size += $fileTreeSize($value); } else { - $size += (isset($value['']['length']) && is_numeric($value['']['length'])) ? $value['']['length'] : self::torrent_error_exit($lang['TORFILE_INVALID']); + if (isset($value['']['length']) && is_numeric($value['']['length'])) { + $size += $value['']['length']; + } else { + self::torrent_error_exit($lang['TORFILE_INVALID']); + } } }