thrownewFileException(sprintf('Unable to create UploadedFile because "file_uploads" is disabled in your php.ini file (%s)',get_cfg_var('cfg_file_path')));
thrownew\InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".',$key));
}
self::$trustedHeaders[$key]=$value;
}
/**
...
...
@@ -442,29 +512,72 @@ class Request
*
* @return boolean
*/
staticpublicfunctionisProxyTrusted()
publicstaticfunctionisProxyTrusted()
{
returnself::$trustProxy;
}
/**
* Normalizes a query string.
*
* It builds a normalized query string, where keys/value pairs are alphabetized,
* have consistent escaping and unneeded delimiters are removed.
*
* @param string $qs Query string
*
* @return string A normalized query string for the Request
*/
publicstaticfunctionnormalizeQueryString($qs)
{
if(''==$qs){
return'';
}
$parts=array();
$order=array();
foreach(explode('&',$qs)as$param){
if(''===$param||'='===$param[0]){
// Ignore useless delimiters, e.g. "x=y&".
// Also ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway.
// PHP also does not include them when building _GET.
continue;
}
$keyValuePair=explode('=',$param,2);
// GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded).
// PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. This is why we use urldecode and then normalize to