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