Upgrade to 3.6.3

This commit is contained in:
Bastian Allgeier
2022-03-22 10:43:28 +01:00
parent 15da803094
commit f732a03566
275 changed files with 1961 additions and 1126 deletions

View File

@@ -12,7 +12,7 @@ use Throwable;
* @package Kirby Http
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @copyright Bastian Allgeier
* @license https://opensource.org/licenses/MIT
*/
class Uri
@@ -237,7 +237,7 @@ class Uri
/**
* @param array $props
* @param bool $forwarded
* @param bool $forwarded Deprecated! Todo: remove in 3.7.0
* @return static
*/
public static function current(array $props = [], bool $forwarded = false)
@@ -246,20 +246,13 @@ class Uri
return static::$current;
}
$uri = Server::get('REQUEST_URI') ?? '';
$uri = preg_replace(
'!^(http|https)\:\/\/' . Server::get('HTTP_HOST') . '!',
'',
$uri
);
$uri = parse_url('http://getkirby.com' . $uri);
$uri = Server::requestUri();
$url = new static(array_merge([
'scheme' => Server::https() === true ? 'https' : 'http',
'host' => Server::host($forwarded),
'port' => Server::port($forwarded),
'path' => $uri['path'] ?? null,
'query' => $uri['query'] ?? null,
'host' => Server::host(),
'port' => Server::port(),
'path' => $uri['path'],
'query' => $uri['query'],
], $props));
return $url;
@@ -335,34 +328,16 @@ class Uri
* or any other executed script.
*
* @param array $props
* @param bool $forwarded
* @param bool $forwarded Deprecated! Todo: remove in 3.7.0
* @return string
*/
public static function index(array $props = [], bool $forwarded = false)
{
if (Server::cli() === true) {
$path = null;
} else {
$path = Server::get('SCRIPT_NAME');
// replace Windows backslashes
$path = str_replace('\\', '/', $path);
// remove the script
$path = dirname($path);
// replace those fucking backslashes again
$path = str_replace('\\', '/', $path);
// remove the leading and trailing slashes
$path = trim($path, '/');
}
if ($path === '.') {
$path = null;
}
return static::current(array_merge($props, [
'path' => $path,
'path' => Server::scriptPath(),
'query' => null,
'fragment' => null,
]), $forwarded);
]));
}