filter_gpc() fix for "Fatal error: type of variable X is not recognized".

Ignore unknown gpc variables instead of failing with fatal errors as it isn't useful to report these errors to users. Firewalls or other programs may be inserting these cookies.
Properly store array variables if they are valid arrays.
This commit is contained in:
Chris Morgan
2008-09-14 11:19:08 -04:00
parent 36c0da1c15
commit f8fb363ce4

View File

@@ -94,17 +94,16 @@ function filter_gpc()
}
break;
case "a": // array
if(!is_array($_REQUEST[$aKeys[$i]]))
return "Fatal error: ".$aKeys[$i]." should be an array. ".
$sErrorSuggestion;
// store the value if it is an array
if(is_array($_REQUEST[$aKeys[$i]]))
$aClean[$aKeys[$i]] = $_REQUEST[$aKeys[$i]];
break;
default:
return "Fatal error: type of variable ".$aKeys[$i]." is not recognized.".
$sErrorSuggestion;
// type not recognized, skip it
break;
}
}
/* null out all input data so we can be assured that */
/* no unfiltered values are being used */
$_REQUEST = array();