allow arrays when sanitizing get query parameters

This commit is contained in:
malve 2025-02-18 21:14:32 +01:00
parent 8f38332fce
commit 743ff69c03

View File

@ -32,9 +32,21 @@ function clean_get() {
foreach($_GET as $key => $value) {
// XSS is possible in both key and values
$k = htmlspecialchars($key);
$v = htmlspecialchars($value);
$temp[$k] = $v;
$key = htmlspecialchars($key);
switch (gettype($value)) {
case "string":
$value = htmlspecialchars($value);
break;
case "array":
array_walk_recursive($value, function(&$v) {
if (gettype($v) == "string") {
$v = htmlspecialchars($v);
}
});
break;
}
$temp[$key] = $value;
}
return $temp;