From 4d09bb549c02ff0dd204ee79ba001c35a9e62ec6 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 10 Jul 2013 13:00:50 -0700 Subject: [PATCH] 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 --- html/inc/util.inc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/html/inc/util.inc b/html/inc/util.inc index 54b4514ead..42971e5f9d 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -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");