Mercurial > hg > fapweb
changeset 1003:668fd0ea4e08
Add check for request items that might not be strings.
Only "trim" the value if it's a string.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 09 Mar 2015 08:03:15 +0200 |
parents | 13b15cef7028 |
children | 76e26fc5d544 |
files | msitegen.inc.php |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/msitegen.inc.php Thu Jan 15 10:33:47 2015 +0200 +++ b/msitegen.inc.php Mon Mar 09 08:03:15 2015 +0200 @@ -516,12 +516,21 @@ } +function stTrimIfString($val) +{ + if (is_string($val)) + return trim($val); + else + return $val; +} + + function stGetRequestItem($name, $default = "", $allowGet = FALSE) { if ($allowGet || stGetSetting("debug")) - return isset($_REQUEST[$name]) ? trim($_REQUEST[$name]) : $default; + return isset($_REQUEST[$name]) ? stTrimIfString($_REQUEST[$name]) : $default; else - return isset($_POST[$name]) ? trim($_POST[$name]) : $default; + return isset($_POST[$name]) ? stTrimIfString($_POST[$name]) : $default; }