Type casting can be used.

This commit is contained in:
Yuriy Pikhtarev 2017-05-09 22:52:46 +03:00
commit 1f44ed29aa
No known key found for this signature in database
GPG key ID: 3A9B5A757B48ECC6
2 changed files with 4 additions and 4 deletions

View file

@ -121,8 +121,8 @@ function sort_multi_array($sort_array, $key, $sort_order, $pre_string_sort = 0)
// do checks based on key // do checks based on key
$switch = false; $switch = false;
if (!$string_sort) { if (!$string_sort) {
if (($sort_order == 'DESC' && 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' && intval(@$sort_array[$j][$key]) > intval(@$sort_array[$j + 1][$key]))) { ($sort_order == 'ASC' && (int)(@$sort_array[$j][$key]) > (int)(@$sort_array[$j + 1][$key]))) {
$switch = true; $switch = true;
} }
} else { } else {

View file

@ -703,7 +703,7 @@ function bdecode_r($str, &$pos)
return null; return null;
} else { } else {
$pos++; $pos++;
return floatval(substr($str, $spos, $numlen)); return (float)substr($str, $spos, $numlen);
} }
} elseif ($str[$pos] == 'd') { } elseif ($str[$pos] == 'd') {
$pos++; $pos++;
@ -757,7 +757,7 @@ function bdecode_r($str, &$pos)
if (($pos >= $strlen) || ($str[$pos] != ':')) { if (($pos >= $strlen) || ($str[$pos] != ':')) {
return null; return null;
} else { } else {
$vallen = intval(substr($str, $spos, $numlen)); $vallen = (int)substr($str, $spos, $numlen);
$pos++; $pos++;
$val = substr($str, $pos, $vallen); $val = substr($str, $pos, $vallen);