web: fix bug where am_set_info RPC incorrectly removed people from teams

The problem: post_int() was returning 0 rather than null when arg is missing
This commit is contained in:
David Anderson 2013-07-10 13:00:50 -07:00
parent 468add64e5
commit 4d09bb549c
1 changed files with 7 additions and 0 deletions

View File

@ -572,6 +572,8 @@ function check_get_args($args) {
}
}
// returns null if the arg is optional and missing
//
function get_int($name, $optional=false) {
$x=null;
if (isset($_GET[$name])) $x = $_GET[$name];
@ -590,6 +592,8 @@ function get_int($name, $optional=false) {
return (int)$x;
}
// returns null if the arg is optional and missing
//
function post_num($name, $optional=false) {
$x = null;
if (isset($_POST[$name])) $x = $_POST[$name];
@ -603,8 +607,11 @@ function post_num($name, $optional=false) {
return (double)$x;
}
// returns null if the arg is optional and missing
//
function post_int($name, $optional=false) {
$x = post_num($name, $optional);
if (is_null($x)) return null;
$y = (int)$x;
if ($x != $y) {
error_page("param $name must be an integer");