diff options
author | emkael <emkael@tlen.pl> | 2019-01-20 11:26:21 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-01-20 11:26:21 +0100 |
commit | a4c619ec6aad97e44d8c6f38e5c510cd7ae66621 (patch) | |
tree | d5d7f27e38fc0788ec257655921834cb35e21384 /http/api.php | |
parent | ef0d10d63586f671e9c3b7266df9895f7e175ccd (diff) |
Cutoff parameters sanitation
Diffstat (limited to 'http/api.php')
-rw-r--r-- | http/api.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/http/api.php b/http/api.php index bccd5d3..ab8d002 100644 --- a/http/api.php +++ b/http/api.php @@ -127,14 +127,17 @@ function parse_parameters($parameters) { if ($return['points_cutoffs'][count($return['points_cutoffs'])-1][1] != 0.0) { array_push($return['points_cutoffs'], array(1.0, 0.0)); } - foreach ($return['points_cutoffs'] as $cutoff) { + foreach ($return['points_cutoffs'] as &$cutoff) { if (($cutoff[0] < 0.0) || ($cutoff[0] > 1.0)) { throw new ParametersException('Cutoff points need to be between 0.0 and 1.0: ' . $cutoff[0]); } + $cutoff[0] = floatval($cutoff[0]); if (($cutoff[1] < 0.0) || ($cutoff[1] > 1.0)) { throw new ParametersException('Cutoff values need to be between 1.0 and 0.0: ' . $cutoff[1]); } + $cutoff[1] = floatval($cutoff[1]); } + unset($cutoff); for ($prev = 0; $prev < count($return['points_cutoffs']) - 1; $prev++) { $next = $prev + 1; if ($return['points_cutoffs'][$prev][0] >= $return['points_cutoffs'][$next][0]) { |