From 1f44ed29aa79c57f7f8fb728733329ae6c387325 Mon Sep 17 00:00:00 2001 From: Yuriy Pikhtarev Date: Tue, 9 May 2017 22:52:46 +0300 Subject: [PATCH] Type casting can be used. --- library/attach_mod/includes/functions_admin.php | 4 ++-- library/includes/functions_torrent.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/attach_mod/includes/functions_admin.php b/library/attach_mod/includes/functions_admin.php index 111412187..f416501e7 100644 --- a/library/attach_mod/includes/functions_admin.php +++ b/library/attach_mod/includes/functions_admin.php @@ -121,8 +121,8 @@ function sort_multi_array($sort_array, $key, $sort_order, $pre_string_sort = 0) // do checks based on key $switch = false; if (!$string_sort) { - if (($sort_order == 'DESC' && intval(@$sort_array[$j][$key]) < intval(@$sort_array[$j + 1][$key])) || - ($sort_order == 'ASC' && intval(@$sort_array[$j][$key]) > intval(@$sort_array[$j + 1][$key]))) { + if (($sort_order == 'DESC' && (int)(@$sort_array[$j][$key]) < (int)(@$sort_array[$j + 1][$key])) || + ($sort_order == 'ASC' && (int)(@$sort_array[$j][$key]) > (int)(@$sort_array[$j + 1][$key]))) { $switch = true; } } else { diff --git a/library/includes/functions_torrent.php b/library/includes/functions_torrent.php index 181604f7b..c386c1916 100644 --- a/library/includes/functions_torrent.php +++ b/library/includes/functions_torrent.php @@ -703,7 +703,7 @@ function bdecode_r($str, &$pos) return null; } else { $pos++; - return floatval(substr($str, $spos, $numlen)); + return (float)substr($str, $spos, $numlen); } } elseif ($str[$pos] == 'd') { $pos++; @@ -757,7 +757,7 @@ function bdecode_r($str, &$pos) if (($pos >= $strlen) || ($str[$pos] != ':')) { return null; } else { - $vallen = intval(substr($str, $spos, $numlen)); + $vallen = (int)substr($str, $spos, $numlen); $pos++; $val = substr($str, $pos, $vallen);