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
$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 {

View file

@ -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);