Skip to content

Commit

Permalink
Merge ab5fa78 into 30cfe3c
Browse files Browse the repository at this point in the history
  • Loading branch information
adambro committed May 27, 2016
2 parents 30cfe3c + ab5fa78 commit af3fc17
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Slim/Http/Uri.php
Expand Up @@ -218,6 +218,9 @@ public static function createFromEnvironment(Environment $env)

// Query string
$queryString = $env->get('QUERY_STRING', '');
if ($queryString === '') {
$queryString = parse_url('http://example.com' . $env->get('REQUEST_URI'), PHP_URL_QUERY);
}

// Fragment
$fragment = '';
Expand Down
12 changes: 12 additions & 0 deletions tests/Http/UriTest.php
Expand Up @@ -633,4 +633,16 @@ public function testRequestURIContainsIndexDotPhp()
);
$this->assertSame('/foo/index.php', $uri->getBasePath());
}

public function testRequestURICanContainParams()
{
$uri = Uri::createFromEnvironment(
Environment::mock(
[
'REQUEST_URI' => '/foo?abc=123',
]
)
);
$this->assertEquals('abc=123', $uri->getQuery());
}
}

0 comments on commit af3fc17

Please sign in to comment.