Open Journal Systems  3.3.0
lib/vendor/symfony/http-foundation/Request.php
1 <?php
2 
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
13 
17 
31 class Request
32 {
33  const HEADER_FORWARDED = 0b00001; // When using RFC 7239
34  const HEADER_X_FORWARDED_FOR = 0b00010;
35  const HEADER_X_FORWARDED_HOST = 0b00100;
36  const HEADER_X_FORWARDED_PROTO = 0b01000;
37  const HEADER_X_FORWARDED_PORT = 0b10000;
38  const HEADER_X_FORWARDED_ALL = 0b11110; // All "X-Forwarded-*" headers
39  const HEADER_X_FORWARDED_AWS_ELB = 0b11010; // AWS ELB doesn't send X-Forwarded-Host
40 
49 
50  const METHOD_HEAD = 'HEAD';
51  const METHOD_GET = 'GET';
52  const METHOD_POST = 'POST';
53  const METHOD_PUT = 'PUT';
54  const METHOD_PATCH = 'PATCH';
55  const METHOD_DELETE = 'DELETE';
56  const METHOD_PURGE = 'PURGE';
57  const METHOD_OPTIONS = 'OPTIONS';
58  const METHOD_TRACE = 'TRACE';
59  const METHOD_CONNECT = 'CONNECT';
60 
64  protected static $trustedProxies = array();
65 
69  protected static $trustedHostPatterns = array();
70 
74  protected static $trustedHosts = array();
75 
87  protected static $trustedHeaders = array(
88  self::HEADER_FORWARDED => 'FORWARDED',
89  self::HEADER_CLIENT_IP => 'X_FORWARDED_FOR',
90  self::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST',
91  self::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO',
92  self::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT',
93  );
94 
95  protected static $httpMethodParameterOverride = false;
96 
102  public $attributes;
103 
109  public $request;
110 
116  public $query;
117 
123  public $server;
124 
130  public $files;
131 
137  public $cookies;
138 
144  public $headers;
145 
149  protected $content;
150 
154  protected $languages;
155 
159  protected $charsets;
160 
164  protected $encodings;
165 
169  protected $acceptableContentTypes;
170 
174  protected $pathInfo;
175 
179  protected $requestUri;
180 
184  protected $baseUrl;
185 
189  protected $basePath;
190 
194  protected $method;
195 
199  protected $format;
200 
204  protected $session;
205 
209  protected $locale;
210 
214  protected $defaultLocale = 'en';
215 
219  protected static $formats;
220 
221  protected static $requestFactory;
222 
223  private $isHostValid = true;
224  private $isClientIpsValid = true;
225  private $isForwardedValid = true;
226 
227  private static $trustedHeaderSet = -1;
228 
230  private static $trustedHeaderNames = array(
231  self::HEADER_FORWARDED => 'FORWARDED',
232  self::HEADER_CLIENT_IP => 'X_FORWARDED_FOR',
233  self::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST',
234  self::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO',
235  self::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT',
236  );
237 
238  private static $forwardedParams = array(
239  self::HEADER_X_FORWARDED_FOR => 'for',
240  self::HEADER_X_FORWARDED_HOST => 'host',
241  self::HEADER_X_FORWARDED_PROTO => 'proto',
242  self::HEADER_X_FORWARDED_PORT => 'host',
243  );
244 
256  public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
257  {
259  }
260 
274  public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
275  {
276  $this->request = new ParameterBag($request);
277  $this->query = new ParameterBag($query);
278  $this->attributes = new ParameterBag($attributes);
279  $this->cookies = new ParameterBag($cookies);
280  $this->files = new FileBag($files);
281  $this->server = new ServerBag($server);
282  $this->headers = new HeaderBag($this->server->getHeaders());
283 
284  $this->content = $content;
285  $this->languages = null;
286  $this->charsets = null;
287  $this->encodings = null;
288  $this->acceptableContentTypes = null;
289  $this->pathInfo = null;
290  $this->requestUri = null;
291  $this->baseUrl = null;
292  $this->basePath = null;
293  $this->method = null;
294  $this->format = null;
295  }
296 
302  public static function createFromGlobals()
303  {
304  // With the php's bug #66606, the php's built-in web server
305  // stores the Content-Type and Content-Length header values in
306  // HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH fields.
307  $server = $_SERVER;
308  if ('cli-server' === PHP_SAPI) {
309  if (array_key_exists('HTTP_CONTENT_LENGTH', $_SERVER)) {
310  $server['CONTENT_LENGTH'] = $_SERVER['HTTP_CONTENT_LENGTH'];
311  }
312  if (array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) {
313  $server['CONTENT_TYPE'] = $_SERVER['HTTP_CONTENT_TYPE'];
314  }
315  }
316 
317  $request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $server);
318 
319  if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded')
320  && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH'))
321  ) {
322  parse_str($request->getContent(), $data);
323  $request->request = new ParameterBag($data);
324  }
325 
326  return $request;
327  }
328 
345  public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null)
346  {
347  $server = array_replace(array(
348  'SERVER_NAME' => 'localhost',
349  'SERVER_PORT' => 80,
350  'HTTP_HOST' => 'localhost',
351  'HTTP_USER_AGENT' => 'Symfony/3.X',
352  'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
353  'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5',
354  'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
355  'REMOTE_ADDR' => '127.0.0.1',
356  'SCRIPT_NAME' => '',
357  'SCRIPT_FILENAME' => '',
358  'SERVER_PROTOCOL' => 'HTTP/1.1',
359  'REQUEST_TIME' => time(),
360  ), $server);
361 
362  $server['PATH_INFO'] = '';
363  $server['REQUEST_METHOD'] = strtoupper($method);
364 
365  $components = parse_url($uri);
366  if (isset($components['host'])) {
367  $server['SERVER_NAME'] = $components['host'];
368  $server['HTTP_HOST'] = $components['host'];
369  }
370 
371  if (isset($components['scheme'])) {
372  if ('https' === $components['scheme']) {
373  $server['HTTPS'] = 'on';
374  $server['SERVER_PORT'] = 443;
375  } else {
376  unset($server['HTTPS']);
377  $server['SERVER_PORT'] = 80;
378  }
379  }
380 
381  if (isset($components['port'])) {
382  $server['SERVER_PORT'] = $components['port'];
383  $server['HTTP_HOST'] = $server['HTTP_HOST'].':'.$components['port'];
384  }
385 
386  if (isset($components['user'])) {
387  $server['PHP_AUTH_USER'] = $components['user'];
388  }
389 
390  if (isset($components['pass'])) {
391  $server['PHP_AUTH_PW'] = $components['pass'];
392  }
393 
394  if (!isset($components['path'])) {
395  $components['path'] = '/';
396  }
397 
398  switch (strtoupper($method)) {
399  case 'POST':
400  case 'PUT':
401  case 'DELETE':
402  if (!isset($server['CONTENT_TYPE'])) {
403  $server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
404  }
405  // no break
406  case 'PATCH':
407  $request = $parameters;
408  $query = array();
409  break;
410  default:
411  $request = array();
412  $query = $parameters;
413  break;
414  }
415 
416  $queryString = '';
417  if (isset($components['query'])) {
418  parse_str(html_entity_decode($components['query']), $qs);
419 
420  if ($query) {
421  $query = array_replace($qs, $query);
422  $queryString = http_build_query($query, '', '&');
423  } else {
424  $query = $qs;
425  $queryString = $components['query'];
426  }
427  } elseif ($query) {
428  $queryString = http_build_query($query, '', '&');
429  }
430 
431  $server['REQUEST_URI'] = $components['path'].('' !== $queryString ? '?'.$queryString : '');
432  $server['QUERY_STRING'] = $queryString;
433 
434  return self::createRequestFromFactory($query, $request, array(), $cookies, $files, $server, $content);
435  }
436 
446  public static function setFactory($callable)
447  {
448  self::$requestFactory = $callable;
449  }
450 
463  public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null)
464  {
465  $dup = clone $this;
466  if ($query !== null) {
467  $dup->query = new ParameterBag($query);
468  }
469  if ($request !== null) {
470  $dup->request = new ParameterBag($request);
471  }
472  if ($attributes !== null) {
473  $dup->attributes = new ParameterBag($attributes);
474  }
475  if ($cookies !== null) {
476  $dup->cookies = new ParameterBag($cookies);
477  }
478  if ($files !== null) {
479  $dup->files = new FileBag($files);
480  }
481  if ($server !== null) {
482  $dup->server = new ServerBag($server);
483  $dup->headers = new HeaderBag($dup->server->getHeaders());
484  }
485  $dup->languages = null;
486  $dup->charsets = null;
487  $dup->encodings = null;
488  $dup->acceptableContentTypes = null;
489  $dup->pathInfo = null;
490  $dup->requestUri = null;
491  $dup->baseUrl = null;
492  $dup->basePath = null;
493  $dup->method = null;
494  $dup->format = null;
495 
496  if (!$dup->get('_format') && $this->get('_format')) {
497  $dup->attributes->set('_format', $this->get('_format'));
498  }
499 
500  if (!$dup->getRequestFormat(null)) {
501  $dup->setRequestFormat($this->getRequestFormat(null));
502  }
503 
504  return $dup;
505  }
506 
513  public function __clone()
514  {
515  $this->query = clone $this->query;
516  $this->request = clone $this->request;
517  $this->attributes = clone $this->attributes;
518  $this->cookies = clone $this->cookies;
519  $this->files = clone $this->files;
520  $this->server = clone $this->server;
521  $this->headers = clone $this->headers;
522  }
523 
529  public function __toString()
530  {
531  try {
532  $content = $this->getContent();
533  } catch (\LogicException $e) {
534  return trigger_error($e, E_USER_ERROR);
535  }
536 
537  return
538  sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n".
539  $this->headers."\r\n".
540  $content;
541  }
542 
549  public function overrideGlobals()
550  {
551  $this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), null, '&')));
552 
553  $_GET = $this->query->all();
554  $_POST = $this->request->all();
555  $_SERVER = $this->server->all();
556  $_COOKIE = $this->cookies->all();
557 
558  foreach ($this->headers->all() as $key => $value) {
559  $key = strtoupper(str_replace('-', '_', $key));
560  if (in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) {
561  $_SERVER[$key] = implode(', ', $value);
562  } else {
563  $_SERVER['HTTP_'.$key] = implode(', ', $value);
564  }
565  }
566 
567  $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE);
568 
569  $requestOrder = ini_get('request_order') ?: ini_get('variables_order');
570  $requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp';
571 
572  $_REQUEST = array();
573  foreach (str_split($requestOrder) as $order) {
574  $_REQUEST = array_merge($_REQUEST, $request[$order]);
575  }
576  }
577 
588  public static function setTrustedProxies(array $proxies/*, int $trustedHeaderSet*/)
589  {
590  self::$trustedProxies = $proxies;
591 
592  if (2 > func_num_args()) {
593  @trigger_error(sprintf('The %s() method expects a bit field of Request::HEADER_* as second argument since version 3.3. Defining it will be required in 4.0. ', __METHOD__), E_USER_DEPRECATED);
594 
595  return;
596  }
597  $trustedHeaderSet = (int) func_get_arg(1);
598 
599  foreach (self::$trustedHeaderNames as $header => $name) {
600  self::$trustedHeaders[$header] = $header & $trustedHeaderSet ? $name : null;
601  }
602  self::$trustedHeaderSet = $trustedHeaderSet;
603  }
604 
610  public static function getTrustedProxies()
611  {
613  }
614 
620  public static function getTrustedHeaderSet()
621  {
622  return self::$trustedHeaderSet;
623  }
624 
632  public static function setTrustedHosts(array $hostPatterns)
633  {
634  self::$trustedHostPatterns = array_map(function ($hostPattern) {
635  return sprintf('#%s#i', $hostPattern);
636  }, $hostPatterns);
637  // we need to reset trusted hosts on trusted host patterns change
638  self::$trustedHosts = array();
639  }
640 
646  public static function getTrustedHosts()
647  {
649  }
650 
671  public static function setTrustedHeaderName($key, $value)
672  {
673  @trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.', __METHOD__), E_USER_DEPRECATED);
674 
675  if ('forwarded' === $key) {
676  $key = self::HEADER_FORWARDED;
677  } elseif ('client_ip' === $key) {
678  $key = self::HEADER_CLIENT_IP;
679  } elseif ('client_host' === $key) {
681  } elseif ('client_proto' === $key) {
683  } elseif ('client_port' === $key) {
685  } elseif (!array_key_exists($key, self::$trustedHeaders)) {
686  throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key));
687  }
688 
689  self::$trustedHeaders[$key] = $value;
690 
691  if (null !== $value) {
692  self::$trustedHeaderNames[$key] = $value;
693  self::$trustedHeaderSet |= $key;
694  } else {
695  self::$trustedHeaderSet &= ~$key;
696  }
697  }
698 
710  public static function getTrustedHeaderName($key)
711  {
712  if (2 > func_num_args() || func_get_arg(1)) {
713  @trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead.', __METHOD__), E_USER_DEPRECATED);
714  }
715 
716  if (!array_key_exists($key, self::$trustedHeaders)) {
717  throw new \InvalidArgumentException(sprintf('Unable to get the trusted header name for key "%s".', $key));
718  }
719 
720  return self::$trustedHeaders[$key];
721  }
722 
733  public static function normalizeQueryString($qs)
734  {
735  if ('' == $qs) {
736  return '';
737  }
738 
739  $parts = array();
740  $order = array();
741 
742  foreach (explode('&', $qs) as $param) {
743  if ('' === $param || '=' === $param[0]) {
744  // Ignore useless delimiters, e.g. "x=y&".
745  // Also ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway.
746  // PHP also does not include them when building _GET.
747  continue;
748  }
749 
750  $keyValuePair = explode('=', $param, 2);
751 
752  // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded).
753  // 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
754  // RFC 3986 with rawurlencode.
755  $parts[] = isset($keyValuePair[1]) ?
756  rawurlencode(urldecode($keyValuePair[0])).'='.rawurlencode(urldecode($keyValuePair[1])) :
757  rawurlencode(urldecode($keyValuePair[0]));
758  $order[] = urldecode($keyValuePair[0]);
759  }
760 
761  array_multisort($order, SORT_ASC, $parts);
762 
763  return implode('&', $parts);
764  }
765 
777  public static function enableHttpMethodParameterOverride()
778  {
779  self::$httpMethodParameterOverride = true;
780  }
781 
787  public static function getHttpMethodParameterOverride()
788  {
790  }
791 
806  public function get($key, $default = null)
807  {
808  if ($this !== $result = $this->attributes->get($key, $this)) {
809  return $result;
810  }
811 
812  if ($this !== $result = $this->query->get($key, $this)) {
813  return $result;
814  }
815 
816  if ($this !== $result = $this->request->get($key, $this)) {
817  return $result;
818  }
819 
820  return $default;
821  }
822 
828  public function getSession()
829  {
830  return $this->session;
831  }
832 
839  public function hasPreviousSession()
840  {
841  // the check for $this->session avoids malicious users trying to fake a session cookie with proper name
842  return $this->hasSession() && $this->cookies->has($this->session->getName());
843  }
844 
854  public function hasSession()
855  {
856  return null !== $this->session;
857  }
858 
864  public function setSession(SessionInterface $session)
865  {
866  $this->session = $session;
867  }
868 
882  public function getClientIps()
883  {
884  $ip = $this->server->get('REMOTE_ADDR');
885 
886  if (!$this->isFromTrustedProxy()) {
887  return array($ip);
888  }
889 
890  return $this->getTrustedValues(self::HEADER_CLIENT_IP, $ip) ?: array($ip);
891  }
892 
911  public function getClientIp()
912  {
913  $ipAddresses = $this->getClientIps();
914 
915  return $ipAddresses[0];
916  }
917 
923  public function getScriptName()
924  {
925  return $this->server->get('SCRIPT_NAME', $this->server->get('ORIG_SCRIPT_NAME', ''));
926  }
927 
942  public function getPathInfo()
943  {
944  if (null === $this->pathInfo) {
945  $this->pathInfo = $this->preparePathInfo();
946  }
947 
948  return $this->pathInfo;
949  }
950 
963  public function getBasePath()
964  {
965  if (null === $this->basePath) {
966  $this->basePath = $this->prepareBasePath();
967  }
968 
969  return $this->basePath;
970  }
971 
982  public function getBaseUrl()
983  {
984  if (null === $this->baseUrl) {
985  $this->baseUrl = $this->prepareBaseUrl();
986  }
987 
988  return $this->baseUrl;
989  }
990 
996  public function getScheme()
997  {
998  return $this->isSecure() ? 'https' : 'http';
999  }
1000 
1015  public function getPort()
1016  {
1017  if ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_PORT)) {
1018  $host = $host[0];
1019  } elseif ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_HOST)) {
1020  $host = $host[0];
1021  } elseif (!$host = $this->headers->get('HOST')) {
1022  return $this->server->get('SERVER_PORT');
1023  }
1024 
1025  if ($host[0] === '[') {
1026  $pos = strpos($host, ':', strrpos($host, ']'));
1027  } else {
1028  $pos = strrpos($host, ':');
1029  }
1030 
1031  if (false !== $pos) {
1032  return (int) substr($host, $pos + 1);
1033  }
1034 
1035  return 'https' === $this->getScheme() ? 443 : 80;
1036  }
1037 
1043  public function getUser()
1044  {
1045  return $this->headers->get('PHP_AUTH_USER');
1046  }
1047 
1053  public function getPassword()
1054  {
1055  return $this->headers->get('PHP_AUTH_PW');
1056  }
1057 
1063  public function getUserInfo()
1064  {
1065  $userinfo = $this->getUser();
1066 
1067  $pass = $this->getPassword();
1068  if ('' != $pass) {
1069  $userinfo .= ":$pass";
1070  }
1071 
1072  return $userinfo;
1073  }
1074 
1082  public function getHttpHost()
1083  {
1084  $scheme = $this->getScheme();
1085  $port = $this->getPort();
1086 
1087  if (('http' == $scheme && $port == 80) || ('https' == $scheme && $port == 443)) {
1088  return $this->getHost();
1089  }
1090 
1091  return $this->getHost().':'.$port;
1092  }
1093 
1099  public function getRequestUri()
1100  {
1101  if (null === $this->requestUri) {
1102  $this->requestUri = $this->prepareRequestUri();
1103  }
1104 
1105  return $this->requestUri;
1106  }
1107 
1116  public function getSchemeAndHttpHost()
1117  {
1118  return $this->getScheme().'://'.$this->getHttpHost();
1119  }
1120 
1128  public function getUri()
1129  {
1130  if (null !== $qs = $this->getQueryString()) {
1131  $qs = '?'.$qs;
1132  }
1133 
1134  return $this->getSchemeAndHttpHost().$this->getBaseUrl().$this->getPathInfo().$qs;
1135  }
1136 
1144  public function getUriForPath($path)
1145  {
1146  return $this->getSchemeAndHttpHost().$this->getBaseUrl().$path;
1147  }
1148 
1168  public function getRelativeUriForPath($path)
1169  {
1170  // be sure that we are dealing with an absolute path
1171  if (!isset($path[0]) || '/' !== $path[0]) {
1172  return $path;
1173  }
1174 
1175  if ($path === $basePath = $this->getPathInfo()) {
1176  return '';
1177  }
1178 
1179  $sourceDirs = explode('/', isset($basePath[0]) && '/' === $basePath[0] ? substr($basePath, 1) : $basePath);
1180  $targetDirs = explode('/', isset($path[0]) && '/' === $path[0] ? substr($path, 1) : $path);
1181  array_pop($sourceDirs);
1182  $targetFile = array_pop($targetDirs);
1183 
1184  foreach ($sourceDirs as $i => $dir) {
1185  if (isset($targetDirs[$i]) && $dir === $targetDirs[$i]) {
1186  unset($sourceDirs[$i], $targetDirs[$i]);
1187  } else {
1188  break;
1189  }
1190  }
1192  $targetDirs[] = $targetFile;
1193  $path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs);
1194 
1195  // A reference to the same base directory or an empty subdirectory must be prefixed with "./".
1196  // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used
1197  // as the first segment of a relative-path reference, as it would be mistaken for a scheme name
1198  // (see http://tools.ietf.org/html/rfc3986#section-4.2).
1199  return !isset($path[0]) || '/' === $path[0]
1200  || false !== ($colonPos = strpos($path, ':')) && ($colonPos < ($slashPos = strpos($path, '/')) || false === $slashPos)
1201  ? "./$path" : $path;
1202  }
1203 
1212  public function getQueryString()
1213  {
1214  $qs = static::normalizeQueryString($this->server->get('QUERY_STRING'));
1215 
1216  return '' === $qs ? null : $qs;
1217  }
1218 
1233  public function isSecure()
1234  {
1235  if ($this->isFromTrustedProxy() && $proto = $this->getTrustedValues(self::HEADER_CLIENT_PROTO)) {
1236  return in_array(strtolower($proto[0]), array('https', 'on', 'ssl', '1'), true);
1237  }
1238 
1239  $https = $this->server->get('HTTPS');
1240 
1241  return !empty($https) && 'off' !== strtolower($https);
1242  }
1243 
1260  public function getHost()
1261  {
1262  if ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_HOST)) {
1263  $host = $host[0];
1264  } elseif (!$host = $this->headers->get('HOST')) {
1265  if (!$host = $this->server->get('SERVER_NAME')) {
1266  $host = $this->server->get('SERVER_ADDR', '');
1267  }
1268  }
1269 
1270  // trim and remove port number from host
1271  // host is lowercase as per RFC 952/2181
1272  $host = strtolower(preg_replace('/:\d+$/', '', trim($host)));
1273 
1274  // as the host can come from the user (HTTP_HOST and depending on the configuration, SERVER_NAME too can come from the user)
1275  // check that it does not contain forbidden characters (see RFC 952 and RFC 2181)
1276  // use preg_replace() instead of preg_match() to prevent DoS attacks with long host names
1277  if ($host && '' !== preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $host)) {
1278  if (!$this->isHostValid) {
1279  return '';
1280  }
1281  $this->isHostValid = false;
1282 
1283  throw new SuspiciousOperationException(sprintf('Invalid Host "%s".', $host));
1284  }
1285 
1286  if (count(self::$trustedHostPatterns) > 0) {
1287  // to avoid host header injection attacks, you should provide a list of trusted host patterns
1288 
1289  if (in_array($host, self::$trustedHosts)) {
1290  return $host;
1291  }
1292 
1293  foreach (self::$trustedHostPatterns as $pattern) {
1294  if (preg_match($pattern, $host)) {
1295  self::$trustedHosts[] = $host;
1297  return $host;
1298  }
1299  }
1300 
1301  if (!$this->isHostValid) {
1302  return '';
1303  }
1304  $this->isHostValid = false;
1305 
1306  throw new SuspiciousOperationException(sprintf('Untrusted Host "%s".', $host));
1307  }
1308 
1309  return $host;
1310  }
1311 
1317  public function setMethod($method)
1318  {
1319  $this->method = null;
1320  $this->server->set('REQUEST_METHOD', $method);
1321  }
1322 
1338  public function getMethod()
1339  {
1340  if (null === $this->method) {
1341  $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
1342 
1343  if ('POST' === $this->method) {
1344  if ($method = $this->headers->get('X-HTTP-METHOD-OVERRIDE')) {
1345  $this->method = strtoupper($method);
1346  } elseif (self::$httpMethodParameterOverride) {
1347  $this->method = strtoupper($this->request->get('_method', $this->query->get('_method', 'POST')));
1348  }
1349  }
1350  }
1351 
1352  return $this->method;
1353  }
1354 
1362  public function getRealMethod()
1363  {
1364  return strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
1365  }
1366 
1374  public function getMimeType($format)
1375  {
1376  if (null === static::$formats) {
1377  static::initializeFormats();
1378  }
1379 
1380  return isset(static::$formats[$format]) ? static::$formats[$format][0] : null;
1381  }
1382 
1390  public static function getMimeTypes($format)
1391  {
1392  if (null === static::$formats) {
1393  static::initializeFormats();
1394  }
1395 
1396  return isset(static::$formats[$format]) ? static::$formats[$format] : array();
1397  }
1398 
1406  public function getFormat($mimeType)
1407  {
1408  $canonicalMimeType = null;
1409  if (false !== $pos = strpos($mimeType, ';')) {
1410  $canonicalMimeType = substr($mimeType, 0, $pos);
1411  }
1412 
1413  if (null === static::$formats) {
1414  static::initializeFormats();
1415  }
1416 
1417  foreach (static::$formats as $format => $mimeTypes) {
1418  if (in_array($mimeType, (array) $mimeTypes)) {
1419  return $format;
1420  }
1421  if (null !== $canonicalMimeType && in_array($canonicalMimeType, (array) $mimeTypes)) {
1422  return $format;
1423  }
1424  }
1425  }
1426 
1433  public function setFormat($format, $mimeTypes)
1434  {
1435  if (null === static::$formats) {
1436  static::initializeFormats();
1437  }
1438 
1439  static::$formats[$format] = is_array($mimeTypes) ? $mimeTypes : array($mimeTypes);
1440  }
1441 
1455  public function getRequestFormat($default = 'html')
1456  {
1457  if (null === $this->format) {
1458  $this->format = $this->attributes->get('_format');
1459  }
1460 
1461  return null === $this->format ? $default : $this->format;
1462  }
1463 
1469  public function setRequestFormat($format)
1470  {
1471  $this->format = $format;
1472  }
1473 
1479  public function getContentType()
1480  {
1481  return $this->getFormat($this->headers->get('CONTENT_TYPE'));
1482  }
1483 
1489  public function setDefaultLocale($locale)
1490  {
1491  $this->defaultLocale = $locale;
1492 
1493  if (null === $this->locale) {
1494  $this->setPhpDefaultLocale($locale);
1495  }
1496  }
1497 
1503  public function getDefaultLocale()
1504  {
1505  return $this->defaultLocale;
1506  }
1507 
1513  public function setLocale($locale)
1514  {
1515  $this->setPhpDefaultLocale($this->locale = $locale);
1516  }
1517 
1523  public function getLocale()
1524  {
1525  return null === $this->locale ? $this->defaultLocale : $this->locale;
1526  }
1527 
1535  public function isMethod($method)
1536  {
1537  return $this->getMethod() === strtoupper($method);
1538  }
1539 
1549  public function isMethodSafe(/* $andCacheable = true */)
1550  {
1551  if (!func_num_args() || func_get_arg(0)) {
1552  // This deprecation should be turned into a BadMethodCallException in 4.0 (without adding the argument in the signature)
1553  // then setting $andCacheable to false should be deprecated in 4.1
1554  @trigger_error('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since version 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.', E_USER_DEPRECATED);
1555 
1556  return in_array($this->getMethod(), array('GET', 'HEAD'));
1557  }
1558 
1559  return in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE'));
1560  }
1561 
1567  public function isMethodIdempotent()
1568  {
1569  return in_array($this->getMethod(), array('HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE'));
1570  }
1571 
1579  public function isMethodCacheable()
1580  {
1581  return in_array($this->getMethod(), array('GET', 'HEAD'));
1582  }
1583 
1593  public function getContent($asResource = false)
1594  {
1595  $currentContentIsResource = is_resource($this->content);
1596  if (\PHP_VERSION_ID < 50600 && false === $this->content) {
1597  throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.');
1598  }
1599 
1600  if (true === $asResource) {
1601  if ($currentContentIsResource) {
1602  rewind($this->content);
1603 
1604  return $this->content;
1605  }
1606 
1607  // Content passed in parameter (test)
1608  if (is_string($this->content)) {
1609  $resource = fopen('php://temp', 'r+');
1610  fwrite($resource, $this->content);
1611  rewind($resource);
1613  return $resource;
1614  }
1615 
1616  $this->content = false;
1617 
1618  return fopen('php://input', 'rb');
1619  }
1620 
1621  if ($currentContentIsResource) {
1622  rewind($this->content);
1623 
1624  return stream_get_contents($this->content);
1625  }
1626 
1627  if (null === $this->content || false === $this->content) {
1628  $this->content = file_get_contents('php://input');
1629  }
1631  return $this->content;
1632  }
1633 
1639  public function getETags()
1640  {
1641  return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY);
1642  }
1643 
1647  public function isNoCache()
1648  {
1649  return $this->headers->hasCacheControlDirective('no-cache') || 'no-cache' == $this->headers->get('Pragma');
1650  }
1651 
1659  public function getPreferredLanguage(array $locales = null)
1660  {
1661  $preferredLanguages = $this->getLanguages();
1662 
1663  if (empty($locales)) {
1664  return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null;
1665  }
1666 
1667  if (!$preferredLanguages) {
1668  return $locales[0];
1669  }
1670 
1671  $extendedPreferredLanguages = array();
1672  foreach ($preferredLanguages as $language) {
1673  $extendedPreferredLanguages[] = $language;
1674  if (false !== $position = strpos($language, '_')) {
1675  $superLanguage = substr($language, 0, $position);
1676  if (!in_array($superLanguage, $preferredLanguages)) {
1677  $extendedPreferredLanguages[] = $superLanguage;
1678  }
1679  }
1680  }
1681 
1682  $preferredLanguages = array_values(array_intersect($extendedPreferredLanguages, $locales));
1683 
1684  return isset($preferredLanguages[0]) ? $preferredLanguages[0] : $locales[0];
1685  }
1686 
1692  public function getLanguages()
1693  {
1694  if (null !== $this->languages) {
1695  return $this->languages;
1696  }
1697 
1698  $languages = AcceptHeader::fromString($this->headers->get('Accept-Language'))->all();
1699  $this->languages = array();
1700  foreach ($languages as $lang => $acceptHeaderItem) {
1701  if (false !== strpos($lang, '-')) {
1702  $codes = explode('-', $lang);
1703  if ('i' === $codes[0]) {
1704  // Language not listed in ISO 639 that are not variants
1705  // of any listed language, which can be registered with the
1706  // i-prefix, such as i-cherokee
1707  if (count($codes) > 1) {
1708  $lang = $codes[1];
1709  }
1710  } else {
1711  for ($i = 0, $max = count($codes); $i < $max; ++$i) {
1712  if ($i === 0) {
1713  $lang = strtolower($codes[0]);
1714  } else {
1715  $lang .= '_'.strtoupper($codes[$i]);
1716  }
1717  }
1718  }
1719  }
1720 
1721  $this->languages[] = $lang;
1722  }
1723 
1724  return $this->languages;
1725  }
1726 
1732  public function getCharsets()
1733  {
1734  if (null !== $this->charsets) {
1735  return $this->charsets;
1736  }
1737 
1738  return $this->charsets = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Charset'))->all());
1739  }
1740 
1746  public function getEncodings()
1747  {
1748  if (null !== $this->encodings) {
1749  return $this->encodings;
1750  }
1751 
1752  return $this->encodings = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Encoding'))->all());
1753  }
1754 
1760  public function getAcceptableContentTypes()
1761  {
1762  if (null !== $this->acceptableContentTypes) {
1764  }
1765 
1766  return $this->acceptableContentTypes = array_keys(AcceptHeader::fromString($this->headers->get('Accept'))->all());
1767  }
1768 
1779  public function isXmlHttpRequest()
1780  {
1781  return 'XMLHttpRequest' == $this->headers->get('X-Requested-With');
1782  }
1783 
1784  /*
1785  * The following methods are derived from code of the Zend Framework (1.10dev - 2010-01-24)
1786  *
1787  * Code subject to the new BSD license (http://framework.zend.com/license/new-bsd).
1788  *
1789  * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
1790  */
1791 
1792  protected function prepareRequestUri()
1793  {
1794  $requestUri = '';
1796  if ($this->headers->has('X_ORIGINAL_URL')) {
1797  // IIS with Microsoft Rewrite Module
1798  $requestUri = $this->headers->get('X_ORIGINAL_URL');
1799  $this->headers->remove('X_ORIGINAL_URL');
1800  $this->server->remove('HTTP_X_ORIGINAL_URL');
1801  $this->server->remove('UNENCODED_URL');
1802  $this->server->remove('IIS_WasUrlRewritten');
1803  } elseif ($this->headers->has('X_REWRITE_URL')) {
1804  // IIS with ISAPI_Rewrite
1805  $requestUri = $this->headers->get('X_REWRITE_URL');
1806  $this->headers->remove('X_REWRITE_URL');
1807  } elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') {
1808  // IIS7 with URL Rewrite: make sure we get the unencoded URL (double slash problem)
1809  $requestUri = $this->server->get('UNENCODED_URL');
1810  $this->server->remove('UNENCODED_URL');
1811  $this->server->remove('IIS_WasUrlRewritten');
1812  } elseif ($this->server->has('REQUEST_URI')) {
1813  $requestUri = $this->server->get('REQUEST_URI');
1814  // HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path, only use URL path
1815  $schemeAndHttpHost = $this->getSchemeAndHttpHost();
1816  if (strpos($requestUri, $schemeAndHttpHost) === 0) {
1817  $requestUri = substr($requestUri, strlen($schemeAndHttpHost));
1818  }
1819  } elseif ($this->server->has('ORIG_PATH_INFO')) {
1820  // IIS 5.0, PHP as CGI
1821  $requestUri = $this->server->get('ORIG_PATH_INFO');
1822  if ('' != $this->server->get('QUERY_STRING')) {
1823  $requestUri .= '?'.$this->server->get('QUERY_STRING');
1824  }
1825  $this->server->remove('ORIG_PATH_INFO');
1826  }
1827 
1828  // normalize the request URI to ease creating sub-requests from this request
1829  $this->server->set('REQUEST_URI', $requestUri);
1830 
1831  return $requestUri;
1832  }
1833 
1839  protected function prepareBaseUrl()
1840  {
1841  $filename = basename($this->server->get('SCRIPT_FILENAME'));
1843  if (basename($this->server->get('SCRIPT_NAME')) === $filename) {
1844  $baseUrl = $this->server->get('SCRIPT_NAME');
1845  } elseif (basename($this->server->get('PHP_SELF')) === $filename) {
1846  $baseUrl = $this->server->get('PHP_SELF');
1847  } elseif (basename($this->server->get('ORIG_SCRIPT_NAME')) === $filename) {
1848  $baseUrl = $this->server->get('ORIG_SCRIPT_NAME'); // 1and1 shared hosting compatibility
1849  } else {
1850  // Backtrack up the script_filename to find the portion matching
1851  // php_self
1852  $path = $this->server->get('PHP_SELF', '');
1853  $file = $this->server->get('SCRIPT_FILENAME', '');
1854  $segs = explode('/', trim($file, '/'));
1855  $segs = array_reverse($segs);
1856  $index = 0;
1857  $last = count($segs);
1858  $baseUrl = '';
1859  do {
1860  $seg = $segs[$index];
1861  $baseUrl = '/'.$seg.$baseUrl;
1862  ++$index;
1863  } while ($last > $index && (false !== $pos = strpos($path, $baseUrl)) && 0 != $pos);
1864  }
1865 
1866  // Does the baseUrl have anything in common with the request_uri?
1867  $requestUri = $this->getRequestUri();
1868 
1869  if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, $baseUrl)) {
1870  // full $baseUrl matches
1871  return $prefix;
1872  }
1873 
1874  if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, rtrim(dirname($baseUrl), '/'.DIRECTORY_SEPARATOR).'/')) {
1875  // directory portion of $baseUrl matches
1876  return rtrim($prefix, '/'.DIRECTORY_SEPARATOR);
1877  }
1878 
1879  $truncatedRequestUri = $requestUri;
1880  if (false !== $pos = strpos($requestUri, '?')) {
1881  $truncatedRequestUri = substr($requestUri, 0, $pos);
1882  }
1883 
1884  $basename = basename($baseUrl);
1885  if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri), $basename)) {
1886  // no match whatsoever; set it blank
1887  return '';
1888  }
1889 
1890  // If using mod_rewrite or ISAPI_Rewrite strip the script filename
1891  // out of baseUrl. $pos !== 0 makes sure it is not matching a value
1892  // from PATH_INFO or QUERY_STRING
1893  if (strlen($requestUri) >= strlen($baseUrl) && (false !== $pos = strpos($requestUri, $baseUrl)) && $pos !== 0) {
1894  $baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl));
1895  }
1896 
1897  return rtrim($baseUrl, '/'.DIRECTORY_SEPARATOR);
1898  }
1899 
1905  protected function prepareBasePath()
1906  {
1907  $filename = basename($this->server->get('SCRIPT_FILENAME'));
1908  $baseUrl = $this->getBaseUrl();
1909  if (empty($baseUrl)) {
1910  return '';
1911  }
1912 
1913  if (basename($baseUrl) === $filename) {
1914  $basePath = dirname($baseUrl);
1915  } else {
1916  $basePath = $baseUrl;
1917  }
1918 
1919  if ('\\' === DIRECTORY_SEPARATOR) {
1920  $basePath = str_replace('\\', '/', $basePath);
1921  }
1922 
1923  return rtrim($basePath, '/');
1924  }
1925 
1931  protected function preparePathInfo()
1932  {
1933  $baseUrl = $this->getBaseUrl();
1934 
1935  if (null === ($requestUri = $this->getRequestUri())) {
1936  return '/';
1937  }
1938 
1939  // Remove the query string from REQUEST_URI
1940  if ($pos = strpos($requestUri, '?')) {
1941  $requestUri = substr($requestUri, 0, $pos);
1942  }
1943 
1944  $pathInfo = substr($requestUri, strlen($baseUrl));
1945  if (null !== $baseUrl && (false === $pathInfo || '' === $pathInfo)) {
1946  // If substr() returns false then PATH_INFO is set to an empty string
1947  return '/';
1948  } elseif (null === $baseUrl) {
1949  return $requestUri;
1950  }
1951 
1952  return (string) $pathInfo;
1953  }
1954 
1958  protected static function initializeFormats()
1959  {
1960  static::$formats = array(
1961  'html' => array('text/html', 'application/xhtml+xml'),
1962  'txt' => array('text/plain'),
1963  'js' => array('application/javascript', 'application/x-javascript', 'text/javascript'),
1964  'css' => array('text/css'),
1965  'json' => array('application/json', 'application/x-json'),
1966  'xml' => array('text/xml', 'application/xml', 'application/x-xml'),
1967  'rdf' => array('application/rdf+xml'),
1968  'atom' => array('application/atom+xml'),
1969  'rss' => array('application/rss+xml'),
1970  'form' => array('application/x-www-form-urlencoded'),
1971  );
1972  }
1973 
1979  private function setPhpDefaultLocale($locale)
1980  {
1981  // if either the class Locale doesn't exist, or an exception is thrown when
1982  // setting the default locale, the intl module is not installed, and
1983  // the call can be ignored:
1984  try {
1985  if (class_exists('Locale', false)) {
1986  \Locale::setDefault($locale);
1987  }
1988  } catch (\Exception $e) {
1989  }
1990  }
1991 
1992  /*
1993  * Returns the prefix as encoded in the string when the string starts with
1994  * the given prefix, false otherwise.
1995  *
1996  * @param string $string The urlencoded string
1997  * @param string $prefix The prefix not encoded
1998  *
1999  * @return string|false The prefix as it is encoded in $string, or false
2000  */
2001  private function getUrlencodedPrefix($string, $prefix)
2002  {
2003  if (0 !== strpos(rawurldecode($string), $prefix)) {
2004  return false;
2005  }
2006 
2007  $len = strlen($prefix);
2008 
2009  if (preg_match(sprintf('#^(%%[[:xdigit:]]{2}|.){%d}#', $len), $string, $match)) {
2010  return $match[0];
2011  }
2012 
2013  return false;
2014  }
2015 
2016  private static function createRequestFromFactory(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
2017  {
2018  if (self::$requestFactory) {
2019  $request = call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content);
2020 
2021  if (!$request instanceof self) {
2022  throw new \LogicException('The Request factory must return an instance of Symfony\Component\HttpFoundation\Request.');
2023  }
2024 
2025  return $request;
2026  }
2027 
2028  return new static($query, $request, $attributes, $cookies, $files, $server, $content);
2029  }
2030 
2039  public function isFromTrustedProxy()
2040  {
2041  return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR'), self::$trustedProxies);
2042  }
2043 
2044  private function getTrustedValues($type, $ip = null)
2045  {
2046  $clientValues = array();
2047  $forwardedValues = array();
2048 
2049  if (self::$trustedHeaders[$type] && $this->headers->has(self::$trustedHeaders[$type])) {
2050  foreach (explode(',', $this->headers->get(self::$trustedHeaders[$type])) as $v) {
2051  $clientValues[] = (self::HEADER_CLIENT_PORT === $type ? '0.0.0.0:' : '').trim($v);
2052  }
2053  }
2054 
2055  if (self::$trustedHeaders[self::HEADER_FORWARDED] && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) {
2056  $forwardedValues = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]);
2057  $forwardedValues = preg_match_all(sprintf('{(?:%s)=(?:"?\[?)([a-zA-Z0-9\.:_\-/]*+)}', self::$forwardedParams[$type]), $forwardedValues, $matches) ? $matches[1] : array();
2058  }
2059 
2060  if (null !== $ip) {
2061  $clientValues = $this->normalizeAndFilterClientIps($clientValues, $ip);
2062  $forwardedValues = $this->normalizeAndFilterClientIps($forwardedValues, $ip);
2063  }
2064 
2065  if ($forwardedValues === $clientValues || !$clientValues) {
2066  return $forwardedValues;
2067  }
2068 
2069  if (!$forwardedValues) {
2070  return $clientValues;
2071  }
2072 
2073  if (!$this->isForwardedValid) {
2074  return null !== $ip ? array('0.0.0.0', $ip) : array();
2075  }
2076  $this->isForwardedValid = false;
2077 
2078  throw new ConflictingHeadersException(sprintf('The request has both a trusted "%s" header and a trusted "%s" header, conflicting with each other. You should either configure your proxy to remove one of them, or configure your project to distrust the offending one.', self::$trustedHeaders[self::HEADER_FORWARDED], self::$trustedHeaders[$type]));
2079  }
2080 
2081  private function normalizeAndFilterClientIps(array $clientIps, $ip)
2082  {
2083  if (!$clientIps) {
2084  return array();
2085  }
2086  $clientIps[] = $ip; // Complete the IP chain with the IP the request actually came from
2087  $firstTrustedIp = null;
2088 
2089  foreach ($clientIps as $key => $clientIp) {
2090  // Remove port (unfortunately, it does happen)
2091  if (preg_match('{((?:\d+\.){3}\d+)\:\d+}', $clientIp, $match)) {
2092  $clientIps[$key] = $clientIp = $match[1];
2093  }
2094 
2095  if (!filter_var($clientIp, FILTER_VALIDATE_IP)) {
2096  unset($clientIps[$key]);
2097 
2098  continue;
2099  }
2100 
2101  if (IpUtils::checkIp($clientIp, self::$trustedProxies)) {
2102  unset($clientIps[$key]);
2103 
2104  // Fallback to this when the client IP falls into the range of trusted proxies
2105  if (null === $firstTrustedIp) {
2106  $firstTrustedIp = $clientIp;
2107  }
2108  }
2109  }
2110 
2111  // Now the IP chain contains only untrusted proxies and the client IP
2112  return $clientIps ? array_reverse($clientIps) : array($firstTrustedIp);
2113  }
2114 }
Symfony\Component\HttpFoundation\ServerBag
Definition: lib/vendor/symfony/http-foundation/ServerBag.php:21
Symfony\Component\HttpFoundation\Request\getLocale
getLocale()
Definition: lib/vendor/symfony/http-foundation/Request.php:1586
Symfony\Component\HttpFoundation\Request\$encodings
$encodings
Definition: lib/vendor/symfony/http-foundation/Request.php:197
Symfony\Component\HttpFoundation\Request\$languages
$languages
Definition: lib/vendor/symfony/http-foundation/Request.php:181
Symfony\Component\HttpFoundation\Request\enableHttpMethodParameterOverride
static enableHttpMethodParameterOverride()
Definition: lib/vendor/symfony/http-foundation/Request.php:840
Symfony\Component\HttpFoundation\Request\METHOD_DELETE
const METHOD_DELETE
Definition: lib/vendor/symfony/http-foundation/Request.php:55
Symfony\Component\HttpFoundation\Request\__clone
__clone()
Definition: lib/vendor/symfony/http-foundation/Request.php:576
Symfony\Component\HttpFoundation\Request\METHOD_PATCH
const METHOD_PATCH
Definition: lib/vendor/symfony/http-foundation/Request.php:54
Symfony\Component\HttpFoundation\Request\$httpMethodParameterOverride
static $httpMethodParameterOverride
Definition: lib/vendor/symfony/http-foundation/Request.php:96
Symfony\Component\HttpFoundation\Request\getSchemeAndHttpHost
getSchemeAndHttpHost()
Definition: lib/vendor/symfony/http-foundation/Request.php:1179
Symfony\Component\HttpFoundation\Request\METHOD_CONNECT
const METHOD_CONNECT
Definition: lib/vendor/symfony/http-foundation/Request.php:59
Symfony\Component\HttpFoundation\Request\getClientIp
getClientIp()
Definition: lib/vendor/symfony/http-foundation/Request.php:974
Symfony\Component\HttpFoundation\Request\getHttpHost
getHttpHost()
Definition: lib/vendor/symfony/http-foundation/Request.php:1145
Symfony\Component\HttpFoundation\Request\$trustedProxies
static $trustedProxies
Definition: lib/vendor/symfony/http-foundation/Request.php:65
Symfony\Component\HttpFoundation\Request\METHOD_TRACE
const METHOD_TRACE
Definition: lib/vendor/symfony/http-foundation/Request.php:58
Symfony\Component\HttpFoundation\Request\isMethodIdempotent
isMethodIdempotent()
Definition: lib/vendor/symfony/http-foundation/Request.php:1630
Symfony\Component\HttpFoundation\Request\getDefaultLocale
getDefaultLocale()
Definition: lib/vendor/symfony/http-foundation/Request.php:1566
Symfony\Component\HttpFoundation\Request\setSession
setSession(SessionInterface $session)
Definition: lib/vendor/symfony/http-foundation/Request.php:927
Symfony\Component\HttpFoundation\Request\setFactory
static setFactory($callable)
Definition: lib/vendor/symfony/http-foundation/Request.php:509
Symfony\Component\HttpFoundation\Request\getUser
getUser()
Definition: lib/vendor/symfony/http-foundation/Request.php:1106
Symfony\Component\HttpFoundation\Request\$trustedHostPatterns
static $trustedHostPatterns
Definition: lib/vendor/symfony/http-foundation/Request.php:70
Symfony\Component\HttpFoundation\Request\isMethodSafe
isMethodSafe()
Definition: lib/vendor/symfony/http-foundation/Request.php:1612
Symfony\Component\HttpFoundation\Request\HEADER_X_FORWARDED_FOR
const HEADER_X_FORWARDED_FOR
Definition: lib/vendor/symfony/http-foundation/Request.php:34
Symfony\Component\HttpFoundation\IpUtils\checkIp
static checkIp($requestIp, $ips)
Definition: lib/vendor/symfony/http-foundation/IpUtils.php:38
Symfony\Component\HttpFoundation\Request\HEADER_FORWARDED
const HEADER_FORWARDED
Definition: lib/vendor/symfony/http-foundation/Request.php:33
Symfony\Component\HttpFoundation\Request\$session
$session
Definition: lib/vendor/symfony/http-foundation/Request.php:261
Symfony\Component\HttpFoundation\Request\$requestFactory
static $requestFactory
Definition: lib/vendor/symfony/http-foundation/Request.php:284
Symfony\Component\HttpFoundation\Request\getEncodings
getEncodings()
Definition: lib/vendor/symfony/http-foundation/Request.php:1809
Symfony\Component\HttpFoundation\Request\getPathInfo
getPathInfo()
Definition: lib/vendor/symfony/http-foundation/Request.php:1005
Symfony\Component\HttpFoundation\Request\getTrustedProxies
static getTrustedProxies()
Definition: lib/vendor/symfony/http-foundation/Request.php:673
Symfony\Component\HttpFoundation\Request\isNoCache
isNoCache()
Definition: lib/vendor/symfony/http-foundation/Request.php:1710
Symfony\Component\HttpFoundation\Request\getClientIps
getClientIps()
Definition: lib/vendor/symfony/http-foundation/Request.php:945
Symfony\Component\HttpFoundation\Request\$method
$method
Definition: lib/vendor/symfony/http-foundation/Request.php:245
Symfony\Component\HttpFoundation\Request\$content
$content
Definition: lib/vendor/symfony/http-foundation/Request.php:173
Symfony\Component\HttpFoundation\Request\getBasePath
getBasePath()
Definition: lib/vendor/symfony/http-foundation/Request.php:1026
Symfony\Component\HttpFoundation\Request\getUserInfo
getUserInfo()
Definition: lib/vendor/symfony/http-foundation/Request.php:1126
Symfony\Component\HttpFoundation\Request\$requestUri
$requestUri
Definition: lib/vendor/symfony/http-foundation/Request.php:221
Symfony\Component\HttpFoundation\Request\getContentType
getContentType()
Definition: lib/vendor/symfony/http-foundation/Request.php:1542
Symfony\Component\HttpFoundation\Request\METHOD_POST
const METHOD_POST
Definition: lib/vendor/symfony/http-foundation/Request.php:52
Symfony\Component\HttpFoundation\Request\getMethod
getMethod()
Definition: lib/vendor/symfony/http-foundation/Request.php:1401
Symfony\Component\HttpFoundation\Request\HEADER_X_FORWARDED_ALL
const HEADER_X_FORWARDED_ALL
Definition: lib/vendor/symfony/http-foundation/Request.php:38
Symfony\Component\HttpFoundation\Request\getPreferredLanguage
getPreferredLanguage(array $locales=null)
Definition: lib/vendor/symfony/http-foundation/Request.php:1722
Symfony\Component\HttpFoundation\Request\getTrustedHeaderName
static getTrustedHeaderName($key)
Definition: lib/vendor/symfony/http-foundation/Request.php:773
Symfony\Component\HttpFoundation\Request\$files
$files
Definition: lib/vendor/symfony/http-foundation/Request.php:145
Symfony\Component\HttpFoundation\Request\setMethod
setMethod($method)
Definition: lib/vendor/symfony/http-foundation/Request.php:1380
Symfony\Component\HttpFoundation\AcceptHeader\fromString
static fromString($headerValue)
Definition: lib/vendor/symfony/http-foundation/AcceptHeader.php:59
Symfony\Component\HttpFoundation\Request\METHOD_GET
const METHOD_GET
Definition: lib/vendor/symfony/http-foundation/Request.php:51
Symfony\Component\HttpFoundation\Request
Definition: lib/vendor/symfony/http-foundation/Request.php:31
Symfony\Component\HttpFoundation\Session\SessionInterface
Definition: lib/vendor/symfony/http-foundation/Session/SessionInterface.php:21
Symfony\Component\HttpFoundation\Request\METHOD_OPTIONS
const METHOD_OPTIONS
Definition: lib/vendor/symfony/http-foundation/Request.php:57
Symfony\Component\HttpFoundation\Request\$format
$format
Definition: lib/vendor/symfony/http-foundation/Request.php:253
Symfony\Component\HttpFoundation\Request\$trustedHosts
static $trustedHosts
Definition: lib/vendor/symfony/http-foundation/Request.php:75
Symfony\Component\HttpFoundation\Request\prepareRequestUri
prepareRequestUri()
Definition: lib/vendor/symfony/http-foundation/Request.php:1855
Symfony\Component\HttpFoundation\Request\$formats
static $formats
Definition: lib/vendor/symfony/http-foundation/Request.php:282
Symfony\Component\HttpFoundation\Request\HEADER_X_FORWARDED_PROTO
const HEADER_X_FORWARDED_PROTO
Definition: lib/vendor/symfony/http-foundation/Request.php:36
Symfony\Component\HttpFoundation\Request\getTrustedHosts
static getTrustedHosts()
Definition: lib/vendor/symfony/http-foundation/Request.php:709
Symfony\Component\HttpFoundation\Request\HEADER_CLIENT_PORT
const HEADER_CLIENT_PORT
Definition: lib/vendor/symfony/http-foundation/Request.php:48
Symfony\Component\HttpFoundation\Request\HEADER_X_FORWARDED_PORT
const HEADER_X_FORWARDED_PORT
Definition: lib/vendor/symfony/http-foundation/Request.php:37
Symfony\Component\HttpFoundation\Request\initialize
initialize(array $query=array(), array $request=array(), array $attributes=array(), array $cookies=array(), array $files=array(), array $server=array(), $content=null)
Definition: lib/vendor/symfony/http-foundation/Request.php:337
Symfony\Component\HttpFoundation\Request\$acceptableContentTypes
$acceptableContentTypes
Definition: lib/vendor/symfony/http-foundation/Request.php:205
Symfony\Component\HttpFoundation\Request\HEADER_X_FORWARDED_AWS_ELB
const HEADER_X_FORWARDED_AWS_ELB
Definition: lib/vendor/symfony/http-foundation/Request.php:39
Symfony\Component\HttpFoundation\Request\isSecure
isSecure()
Definition: lib/vendor/symfony/http-foundation/Request.php:1296
Symfony\Component\HttpFoundation\Request\$server
$server
Definition: lib/vendor/symfony/http-foundation/Request.php:135
Symfony\Component\HttpFoundation\Request\getContent
getContent($asResource=false)
Definition: lib/vendor/symfony/http-foundation/Request.php:1656
Symfony\Component\HttpFoundation\Request\preparePathInfo
preparePathInfo()
Definition: lib/vendor/symfony/http-foundation/Request.php:1994
Symfony\Component\HttpFoundation\Request\setTrustedProxies
static setTrustedProxies(array $proxies)
Definition: lib/vendor/symfony/http-foundation/Request.php:651
Symfony\Component\HttpFoundation\Request\__toString
__toString()
Definition: lib/vendor/symfony/http-foundation/Request.php:592
Symfony\Component\HttpFoundation\Request\$baseUrl
$baseUrl
Definition: lib/vendor/symfony/http-foundation/Request.php:229
Symfony\Component\HttpFoundation\Request\setLocale
setLocale($locale)
Definition: lib/vendor/symfony/http-foundation/Request.php:1576
Symfony\Component\HttpFoundation\Request\hasSession
hasSession()
Definition: lib/vendor/symfony/http-foundation/Request.php:917
Symfony\Component\HttpFoundation\Request\setFormat
setFormat($format, $mimeTypes)
Definition: lib/vendor/symfony/http-foundation/Request.php:1496
Symfony\Component\HttpFoundation\Request\getHttpMethodParameterOverride
static getHttpMethodParameterOverride()
Definition: lib/vendor/symfony/http-foundation/Request.php:850
Symfony\Component\HttpFoundation\Request\setTrustedHeaderName
static setTrustedHeaderName($key, $value)
Definition: lib/vendor/symfony/http-foundation/Request.php:734
Symfony\Component\HttpFoundation\ParameterBag
Definition: lib/vendor/symfony/http-foundation/ParameterBag.php:19
Symfony\Component\HttpFoundation\Request\getAcceptableContentTypes
getAcceptableContentTypes()
Definition: lib/vendor/symfony/http-foundation/Request.php:1823
Symfony\Component\HttpFoundation\Request\initializeFormats
static initializeFormats()
Definition: lib/vendor/symfony/http-foundation/Request.php:2021
Symfony\Component\HttpFoundation\Request\HEADER_CLIENT_IP
const HEADER_CLIENT_IP
Definition: lib/vendor/symfony/http-foundation/Request.php:42
Symfony\Component\HttpFoundation\Request\$query
$query
Definition: lib/vendor/symfony/http-foundation/Request.php:125
Symfony\Component\HttpFoundation\Request\getRealMethod
getRealMethod()
Definition: lib/vendor/symfony/http-foundation/Request.php:1425
Symfony\Component\HttpFoundation\Request\normalizeQueryString
static normalizeQueryString($qs)
Definition: lib/vendor/symfony/http-foundation/Request.php:796
Symfony\Component\HttpFoundation\Request\getMimeTypes
static getMimeTypes($format)
Definition: lib/vendor/symfony/http-foundation/Request.php:1453
Symfony\Component\HttpFoundation\Request\prepareBaseUrl
prepareBaseUrl()
Definition: lib/vendor/symfony/http-foundation/Request.php:1902
Symfony\Component\HttpFoundation\Request\getQueryString
getQueryString()
Definition: lib/vendor/symfony/http-foundation/Request.php:1275
Symfony\Component\HttpFoundation\Request\getBaseUrl
getBaseUrl()
Definition: lib/vendor/symfony/http-foundation/Request.php:1045
Symfony\Component\HttpFoundation\Request\createFromGlobals
static createFromGlobals()
Definition: lib/vendor/symfony/http-foundation/Request.php:365
Symfony\Component\HttpFoundation\Request\$trustedHeaders
static $trustedHeaders
Definition: lib/vendor/symfony/http-foundation/Request.php:88
Symfony\Component\HttpFoundation\Request\HEADER_X_FORWARDED_HOST
const HEADER_X_FORWARDED_HOST
Definition: lib/vendor/symfony/http-foundation/Request.php:35
Symfony\Component\HttpFoundation\Request\prepareBasePath
prepareBasePath()
Definition: lib/vendor/symfony/http-foundation/Request.php:1968
Symfony\Component\HttpFoundation\Request\isFromTrustedProxy
isFromTrustedProxy()
Definition: lib/vendor/symfony/http-foundation/Request.php:2102
Symfony\Component\HttpFoundation\Request\$locale
$locale
Definition: lib/vendor/symfony/http-foundation/Request.php:269
Symfony\Component\HttpFoundation\Request\getCharsets
getCharsets()
Definition: lib/vendor/symfony/http-foundation/Request.php:1795
Symfony\Component\HttpFoundation\Request\getPort
getPort()
Definition: lib/vendor/symfony/http-foundation/Request.php:1078
Symfony\Component\HttpFoundation\Request\METHOD_HEAD
const METHOD_HEAD
Definition: lib/vendor/symfony/http-foundation/Request.php:50
Symfony\Component\HttpFoundation\Request\$pathInfo
$pathInfo
Definition: lib/vendor/symfony/http-foundation/Request.php:213
Symfony\Component\HttpFoundation
Definition: lib/vendor/symfony/http-foundation/AcceptHeader.php:12
Symfony\Component\HttpFoundation\Request\duplicate
duplicate(array $query=null, array $request=null, array $attributes=null, array $cookies=null, array $files=null, array $server=null)
Definition: lib/vendor/symfony/http-foundation/Request.php:526
Symfony\Component\HttpFoundation\Request\getScheme
getScheme()
Definition: lib/vendor/symfony/http-foundation/Request.php:1059
Symfony\Component\HttpFoundation\FileBag
Definition: lib/vendor/symfony/http-foundation/FileBag.php:22
Symfony\Component\HttpFoundation\HeaderBag
Definition: lib/vendor/symfony/http-foundation/HeaderBag.php:19
Symfony\Component\HttpFoundation\Request\hasPreviousSession
hasPreviousSession()
Definition: lib/vendor/symfony/http-foundation/Request.php:902
Symfony\Component\HttpFoundation\Request\getPassword
getPassword()
Definition: lib/vendor/symfony/http-foundation/Request.php:1116
Symfony\Component\HttpFoundation\Request\overrideGlobals
overrideGlobals()
Definition: lib/vendor/symfony/http-foundation/Request.php:612
Symfony\Component\HttpFoundation\Request\getETags
getETags()
Definition: lib/vendor/symfony/http-foundation/Request.php:1702
Symfony\Component\HttpFoundation\Request\__construct
__construct(array $query=array(), array $request=array(), array $attributes=array(), array $cookies=array(), array $files=array(), array $server=array(), $content=null)
Definition: lib/vendor/symfony/http-foundation/Request.php:319
Symfony\Component\HttpFoundation\Request\METHOD_PURGE
const METHOD_PURGE
Definition: lib/vendor/symfony/http-foundation/Request.php:56
Symfony\Component\HttpFoundation\Request\HEADER_CLIENT_HOST
const HEADER_CLIENT_HOST
Definition: lib/vendor/symfony/http-foundation/Request.php:44
Symfony\Component\HttpFoundation\Request\setDefaultLocale
setDefaultLocale($locale)
Definition: lib/vendor/symfony/http-foundation/Request.php:1552
Symfony\Component\HttpFoundation\Request\$defaultLocale
$defaultLocale
Definition: lib/vendor/symfony/http-foundation/Request.php:277
Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException
Definition: lib/vendor/symfony/http-foundation/Exception/ConflictingHeadersException.php:19
Symfony\Component\HttpFoundation\Request\getLanguages
getLanguages()
Definition: lib/vendor/symfony/http-foundation/Request.php:1755
Symfony\Component\HttpFoundation\Request\getFormat
getFormat($mimeType)
Definition: lib/vendor/symfony/http-foundation/Request.php:1469
Symfony\Component\HttpFoundation\Request\HEADER_CLIENT_PROTO
const HEADER_CLIENT_PROTO
Definition: lib/vendor/symfony/http-foundation/Request.php:46
Symfony\Component\HttpFoundation\Request\getRequestFormat
getRequestFormat($default='html')
Definition: lib/vendor/symfony/http-foundation/Request.php:1518
Symfony\Component\HttpFoundation\Request\METHOD_PUT
const METHOD_PUT
Definition: lib/vendor/symfony/http-foundation/Request.php:53
Symfony\Component\HttpFoundation\Request\setRequestFormat
setRequestFormat($format)
Definition: lib/vendor/symfony/http-foundation/Request.php:1532
Symfony\Component\HttpFoundation\Request\getScriptName
getScriptName()
Definition: lib/vendor/symfony/http-foundation/Request.php:986
Symfony\Component\HttpFoundation\Request\getUri
getUri()
Definition: lib/vendor/symfony/http-foundation/Request.php:1191
Symfony\Component\HttpFoundation\Request\getTrustedHeaderSet
static getTrustedHeaderSet()
Definition: lib/vendor/symfony/http-foundation/Request.php:683
Symfony\Component\HttpFoundation\Request\getHost
getHost()
Definition: lib/vendor/symfony/http-foundation/Request.php:1323
Symfony\Component\HttpFoundation\Request\$basePath
$basePath
Definition: lib/vendor/symfony/http-foundation/Request.php:237
Symfony\Component\HttpFoundation\Request\getUriForPath
getUriForPath($path)
Definition: lib/vendor/symfony/http-foundation/Request.php:1207
Symfony\Component\HttpFoundation\Request\$cookies
$cookies
Definition: lib/vendor/symfony/http-foundation/Request.php:155
Symfony\Component\HttpFoundation\Request\setTrustedHosts
static setTrustedHosts(array $hostPatterns)
Definition: lib/vendor/symfony/http-foundation/Request.php:695
Symfony\Component\HttpFoundation\Request\$attributes
$attributes
Definition: lib/vendor/symfony/http-foundation/Request.php:105
Symfony\Component\HttpFoundation\Request\$headers
$headers
Definition: lib/vendor/symfony/http-foundation/Request.php:165
Symfony\Component\HttpFoundation\Request\$request
$request
Definition: lib/vendor/symfony/http-foundation/Request.php:115
Symfony\Component\HttpFoundation\Request\getRelativeUriForPath
getRelativeUriForPath($path)
Definition: lib/vendor/symfony/http-foundation/Request.php:1231
Symfony\Component\HttpFoundation\Request\getRequestUri
getRequestUri()
Definition: lib/vendor/symfony/http-foundation/Request.php:1162
Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException
Definition: lib/vendor/symfony/http-foundation/Exception/SuspiciousOperationException.php:18
Symfony\Component\HttpFoundation\Request\getSession
getSession()
Definition: lib/vendor/symfony/http-foundation/Request.php:891
Symfony\Component\HttpFoundation\Request\$charsets
$charsets
Definition: lib/vendor/symfony/http-foundation/Request.php:189
Symfony\Component\HttpFoundation\Request\isXmlHttpRequest
isXmlHttpRequest()
Definition: lib/vendor/symfony/http-foundation/Request.php:1842
Symfony\Component\HttpFoundation\Request\isMethod
isMethod($method)
Definition: lib/vendor/symfony/http-foundation/Request.php:1598
Symfony\Component\HttpFoundation\Request\isMethodCacheable
isMethodCacheable()
Definition: lib/vendor/symfony/http-foundation/Request.php:1642
Symfony\Component\HttpFoundation\Request\getMimeType
getMimeType($format)
Definition: lib/vendor/symfony/http-foundation/Request.php:1437
Symfony\Component\HttpFoundation\Request\create
static create($uri, $method='GET', $parameters=array(), $cookies=array(), $files=array(), $server=array(), $content=null)
Definition: lib/vendor/symfony/http-foundation/Request.php:408