Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../vendor/guzzleht.../psr7/src
File: Uri.php
$new->validateState();
[500] Fix | Delete
[501] Fix | Delete
return $new;
[502] Fix | Delete
}
[503] Fix | Delete
[504] Fix | Delete
public function withHost($host)
[505] Fix | Delete
{
[506] Fix | Delete
$host = $this->filterHost($host);
[507] Fix | Delete
[508] Fix | Delete
if ($this->host === $host) {
[509] Fix | Delete
return $this;
[510] Fix | Delete
}
[511] Fix | Delete
[512] Fix | Delete
$new = clone $this;
[513] Fix | Delete
$new->host = $host;
[514] Fix | Delete
$new->validateState();
[515] Fix | Delete
[516] Fix | Delete
return $new;
[517] Fix | Delete
}
[518] Fix | Delete
[519] Fix | Delete
public function withPort($port)
[520] Fix | Delete
{
[521] Fix | Delete
$port = $this->filterPort($port);
[522] Fix | Delete
[523] Fix | Delete
if ($this->port === $port) {
[524] Fix | Delete
return $this;
[525] Fix | Delete
}
[526] Fix | Delete
[527] Fix | Delete
$new = clone $this;
[528] Fix | Delete
$new->port = $port;
[529] Fix | Delete
$new->removeDefaultPort();
[530] Fix | Delete
$new->validateState();
[531] Fix | Delete
[532] Fix | Delete
return $new;
[533] Fix | Delete
}
[534] Fix | Delete
[535] Fix | Delete
public function withPath($path)
[536] Fix | Delete
{
[537] Fix | Delete
$path = $this->filterPath($path);
[538] Fix | Delete
[539] Fix | Delete
if ($this->path === $path) {
[540] Fix | Delete
return $this;
[541] Fix | Delete
}
[542] Fix | Delete
[543] Fix | Delete
$new = clone $this;
[544] Fix | Delete
$new->path = $path;
[545] Fix | Delete
$new->validateState();
[546] Fix | Delete
[547] Fix | Delete
return $new;
[548] Fix | Delete
}
[549] Fix | Delete
[550] Fix | Delete
public function withQuery($query)
[551] Fix | Delete
{
[552] Fix | Delete
$query = $this->filterQueryAndFragment($query);
[553] Fix | Delete
[554] Fix | Delete
if ($this->query === $query) {
[555] Fix | Delete
return $this;
[556] Fix | Delete
}
[557] Fix | Delete
[558] Fix | Delete
$new = clone $this;
[559] Fix | Delete
$new->query = $query;
[560] Fix | Delete
[561] Fix | Delete
return $new;
[562] Fix | Delete
}
[563] Fix | Delete
[564] Fix | Delete
public function withFragment($fragment)
[565] Fix | Delete
{
[566] Fix | Delete
$fragment = $this->filterQueryAndFragment($fragment);
[567] Fix | Delete
[568] Fix | Delete
if ($this->fragment === $fragment) {
[569] Fix | Delete
return $this;
[570] Fix | Delete
}
[571] Fix | Delete
[572] Fix | Delete
$new = clone $this;
[573] Fix | Delete
$new->fragment = $fragment;
[574] Fix | Delete
[575] Fix | Delete
return $new;
[576] Fix | Delete
}
[577] Fix | Delete
[578] Fix | Delete
/**
[579] Fix | Delete
* Apply parse_url parts to a URI.
[580] Fix | Delete
*
[581] Fix | Delete
* @param array $parts Array of parse_url parts to apply.
[582] Fix | Delete
*/
[583] Fix | Delete
private function applyParts(array $parts)
[584] Fix | Delete
{
[585] Fix | Delete
$this->scheme = isset($parts['scheme'])
[586] Fix | Delete
? $this->filterScheme($parts['scheme'])
[587] Fix | Delete
: '';
[588] Fix | Delete
$this->userInfo = isset($parts['user'])
[589] Fix | Delete
? $this->filterUserInfoComponent($parts['user'])
[590] Fix | Delete
: '';
[591] Fix | Delete
$this->host = isset($parts['host'])
[592] Fix | Delete
? $this->filterHost($parts['host'])
[593] Fix | Delete
: '';
[594] Fix | Delete
$this->port = isset($parts['port'])
[595] Fix | Delete
? $this->filterPort($parts['port'])
[596] Fix | Delete
: null;
[597] Fix | Delete
$this->path = isset($parts['path'])
[598] Fix | Delete
? $this->filterPath($parts['path'])
[599] Fix | Delete
: '';
[600] Fix | Delete
$this->query = isset($parts['query'])
[601] Fix | Delete
? $this->filterQueryAndFragment($parts['query'])
[602] Fix | Delete
: '';
[603] Fix | Delete
$this->fragment = isset($parts['fragment'])
[604] Fix | Delete
? $this->filterQueryAndFragment($parts['fragment'])
[605] Fix | Delete
: '';
[606] Fix | Delete
if (isset($parts['pass'])) {
[607] Fix | Delete
$this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']);
[608] Fix | Delete
}
[609] Fix | Delete
[610] Fix | Delete
$this->removeDefaultPort();
[611] Fix | Delete
}
[612] Fix | Delete
[613] Fix | Delete
/**
[614] Fix | Delete
* @param string $scheme
[615] Fix | Delete
*
[616] Fix | Delete
* @return string
[617] Fix | Delete
*
[618] Fix | Delete
* @throws \InvalidArgumentException If the scheme is invalid.
[619] Fix | Delete
*/
[620] Fix | Delete
private function filterScheme($scheme)
[621] Fix | Delete
{
[622] Fix | Delete
if (!is_string($scheme)) {
[623] Fix | Delete
throw new \InvalidArgumentException('Scheme must be a string');
[624] Fix | Delete
}
[625] Fix | Delete
[626] Fix | Delete
return \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
[627] Fix | Delete
}
[628] Fix | Delete
[629] Fix | Delete
/**
[630] Fix | Delete
* @param string $component
[631] Fix | Delete
*
[632] Fix | Delete
* @return string
[633] Fix | Delete
*
[634] Fix | Delete
* @throws \InvalidArgumentException If the user info is invalid.
[635] Fix | Delete
*/
[636] Fix | Delete
private function filterUserInfoComponent($component)
[637] Fix | Delete
{
[638] Fix | Delete
if (!is_string($component)) {
[639] Fix | Delete
throw new \InvalidArgumentException('User info must be a string');
[640] Fix | Delete
}
[641] Fix | Delete
[642] Fix | Delete
return preg_replace_callback(
[643] Fix | Delete
'/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/',
[644] Fix | Delete
[$this, 'rawurlencodeMatchZero'],
[645] Fix | Delete
$component
[646] Fix | Delete
);
[647] Fix | Delete
}
[648] Fix | Delete
[649] Fix | Delete
/**
[650] Fix | Delete
* @param string $host
[651] Fix | Delete
*
[652] Fix | Delete
* @return string
[653] Fix | Delete
*
[654] Fix | Delete
* @throws \InvalidArgumentException If the host is invalid.
[655] Fix | Delete
*/
[656] Fix | Delete
private function filterHost($host)
[657] Fix | Delete
{
[658] Fix | Delete
if (!is_string($host)) {
[659] Fix | Delete
throw new \InvalidArgumentException('Host must be a string');
[660] Fix | Delete
}
[661] Fix | Delete
[662] Fix | Delete
return \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
[663] Fix | Delete
}
[664] Fix | Delete
[665] Fix | Delete
/**
[666] Fix | Delete
* @param int|null $port
[667] Fix | Delete
*
[668] Fix | Delete
* @return int|null
[669] Fix | Delete
*
[670] Fix | Delete
* @throws \InvalidArgumentException If the port is invalid.
[671] Fix | Delete
*/
[672] Fix | Delete
private function filterPort($port)
[673] Fix | Delete
{
[674] Fix | Delete
if ($port === null) {
[675] Fix | Delete
return null;
[676] Fix | Delete
}
[677] Fix | Delete
[678] Fix | Delete
$port = (int) $port;
[679] Fix | Delete
if (0 > $port || 0xffff < $port) {
[680] Fix | Delete
throw new \InvalidArgumentException(
[681] Fix | Delete
sprintf('Invalid port: %d. Must be between 0 and 65535', $port)
[682] Fix | Delete
);
[683] Fix | Delete
}
[684] Fix | Delete
[685] Fix | Delete
return $port;
[686] Fix | Delete
}
[687] Fix | Delete
[688] Fix | Delete
/**
[689] Fix | Delete
* @param UriInterface $uri
[690] Fix | Delete
* @param array $keys
[691] Fix | Delete
*
[692] Fix | Delete
* @return array
[693] Fix | Delete
*/
[694] Fix | Delete
private static function getFilteredQueryString(UriInterface $uri, array $keys)
[695] Fix | Delete
{
[696] Fix | Delete
$current = $uri->getQuery();
[697] Fix | Delete
[698] Fix | Delete
if ($current === '') {
[699] Fix | Delete
return [];
[700] Fix | Delete
}
[701] Fix | Delete
[702] Fix | Delete
$decodedKeys = array_map('rawurldecode', $keys);
[703] Fix | Delete
[704] Fix | Delete
return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
[705] Fix | Delete
return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);
[706] Fix | Delete
});
[707] Fix | Delete
}
[708] Fix | Delete
[709] Fix | Delete
/**
[710] Fix | Delete
* @param string $key
[711] Fix | Delete
* @param string|null $value
[712] Fix | Delete
*
[713] Fix | Delete
* @return string
[714] Fix | Delete
*/
[715] Fix | Delete
private static function generateQueryString($key, $value)
[716] Fix | Delete
{
[717] Fix | Delete
// Query string separators ("=", "&") within the key or value need to be encoded
[718] Fix | Delete
// (while preventing double-encoding) before setting the query string. All other
[719] Fix | Delete
// chars that need percent-encoding will be encoded by withQuery().
[720] Fix | Delete
$queryString = strtr($key, self::$replaceQuery);
[721] Fix | Delete
[722] Fix | Delete
if ($value !== null) {
[723] Fix | Delete
$queryString .= '=' . strtr($value, self::$replaceQuery);
[724] Fix | Delete
}
[725] Fix | Delete
[726] Fix | Delete
return $queryString;
[727] Fix | Delete
}
[728] Fix | Delete
[729] Fix | Delete
private function removeDefaultPort()
[730] Fix | Delete
{
[731] Fix | Delete
if ($this->port !== null && self::isDefaultPort($this)) {
[732] Fix | Delete
$this->port = null;
[733] Fix | Delete
}
[734] Fix | Delete
}
[735] Fix | Delete
[736] Fix | Delete
/**
[737] Fix | Delete
* Filters the path of a URI
[738] Fix | Delete
*
[739] Fix | Delete
* @param string $path
[740] Fix | Delete
*
[741] Fix | Delete
* @return string
[742] Fix | Delete
*
[743] Fix | Delete
* @throws \InvalidArgumentException If the path is invalid.
[744] Fix | Delete
*/
[745] Fix | Delete
private function filterPath($path)
[746] Fix | Delete
{
[747] Fix | Delete
if (!is_string($path)) {
[748] Fix | Delete
throw new \InvalidArgumentException('Path must be a string');
[749] Fix | Delete
}
[750] Fix | Delete
[751] Fix | Delete
return preg_replace_callback(
[752] Fix | Delete
'/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
[753] Fix | Delete
[$this, 'rawurlencodeMatchZero'],
[754] Fix | Delete
$path
[755] Fix | Delete
);
[756] Fix | Delete
}
[757] Fix | Delete
[758] Fix | Delete
/**
[759] Fix | Delete
* Filters the query string or fragment of a URI.
[760] Fix | Delete
*
[761] Fix | Delete
* @param string $str
[762] Fix | Delete
*
[763] Fix | Delete
* @return string
[764] Fix | Delete
*
[765] Fix | Delete
* @throws \InvalidArgumentException If the query or fragment is invalid.
[766] Fix | Delete
*/
[767] Fix | Delete
private function filterQueryAndFragment($str)
[768] Fix | Delete
{
[769] Fix | Delete
if (!is_string($str)) {
[770] Fix | Delete
throw new \InvalidArgumentException('Query and fragment must be a string');
[771] Fix | Delete
}
[772] Fix | Delete
[773] Fix | Delete
return preg_replace_callback(
[774] Fix | Delete
'/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/',
[775] Fix | Delete
[$this, 'rawurlencodeMatchZero'],
[776] Fix | Delete
$str
[777] Fix | Delete
);
[778] Fix | Delete
}
[779] Fix | Delete
[780] Fix | Delete
private function rawurlencodeMatchZero(array $match)
[781] Fix | Delete
{
[782] Fix | Delete
return rawurlencode($match[0]);
[783] Fix | Delete
}
[784] Fix | Delete
[785] Fix | Delete
private function validateState()
[786] Fix | Delete
{
[787] Fix | Delete
if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) {
[788] Fix | Delete
$this->host = self::HTTP_DEFAULT_HOST;
[789] Fix | Delete
}
[790] Fix | Delete
[791] Fix | Delete
if ($this->getAuthority() === '') {
[792] Fix | Delete
if (0 === strpos($this->path, '//')) {
[793] Fix | Delete
throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"');
[794] Fix | Delete
}
[795] Fix | Delete
if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) {
[796] Fix | Delete
throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon');
[797] Fix | Delete
}
[798] Fix | Delete
} elseif (isset($this->path[0]) && $this->path[0] !== '/') {
[799] Fix | Delete
@trigger_error(
[800] Fix | Delete
'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' .
[801] Fix | Delete
'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.',
[802] Fix | Delete
E_USER_DEPRECATED
[803] Fix | Delete
);
[804] Fix | Delete
$this->path = '/' . $this->path;
[805] Fix | Delete
//throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty');
[806] Fix | Delete
}
[807] Fix | Delete
}
[808] Fix | Delete
}
[809] Fix | Delete
[810] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function