Skip to content

Commit

Permalink
Merge pull request #4221 from getkirby/release/3.6.3.1
Browse files Browse the repository at this point in the history
Fix path detection in Server::requestUri
  • Loading branch information
bastianallgeier authored Mar 24, 2022
2 parents 6b20fa1 + 5e196e0 commit e8a40bf
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "The Kirby 3 core",
"license": "proprietary",
"type": "kirby-cms",
"version": "3.6.3",
"version": "3.6.3.1",
"keywords": [
"kirby",
"cms",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion src/Http/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,14 @@ public static function port(bool $forwarded = false): int
public static function requestUri(): array
{
$uri = static::get('REQUEST_URI', '');
$uri = parse_url($uri);

if (Url::isAbsolute($uri) === true) {
$uri = parse_url($uri);
} else {
// the fake domain is needed to make sure the URL parsing is
// always correct. Even if there's a colon in the path for params
$uri = parse_url('http://getkirby.com' . $uri);
}

return [
'path' => $uri['path'] ?? null,
Expand Down
18 changes: 16 additions & 2 deletions tests/Http/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public function provideRequestUri(): array
[
null,
[
'path' => '',
'path' => null,
'query' => null
]
],
Expand All @@ -385,10 +385,24 @@ public function provideRequestUri(): array
'query' => 'foo=bar'
]
],
[
'/foo/bar/page:2?foo=bar',
[
'path' => '/foo/bar/page:2',
'query' => 'foo=bar'
]
],
[
'/foo/bar/page;2?foo=bar',
[
'path' => '/foo/bar/page;2',
'query' => 'foo=bar'
]
],
[
'index.php?foo=bar',
[
'path' => 'index.php',
'path' => null,
'query' => 'foo=bar'
]
],
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php return array(
'root' => array(
'pretty_version' => '3.6.3',
'version' => '3.6.3.0',
'pretty_version' => '3.6.3.1',
'version' => '3.6.3.1',
'type' => 'kirby-cms',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down Expand Up @@ -29,8 +29,8 @@
'dev_requirement' => false,
),
'getkirby/cms' => array(
'pretty_version' => '3.6.3',
'version' => '3.6.3.0',
'pretty_version' => '3.6.3.1',
'version' => '3.6.3.1',
'type' => 'kirby-cms',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down

0 comments on commit e8a40bf

Please sign in to comment.