Fix double ? in uri bug

This commit is contained in:
Dennis Eichhorn 2018-07-06 21:32:57 +02:00
parent f6dd0571a0
commit 46c5647463
2 changed files with 3 additions and 4 deletions

View File

@ -187,11 +187,10 @@ final class UriFactory
*/ */
private static function unique(string $url) : string private static function unique(string $url) : string
{ {
$parts = \explode('?', $url); $parts = \explode('&', \str_replace('?', '&', $url));
if (count($parts) >= 2) { if (count($parts) >= 2) {
$full = $parts[1]; $pars = \array_slice($parts, 1);
$pars = \explode('&', $full);
$comps = []; $comps = [];
$length = count($pars); $length = count($pars);

View File

@ -66,7 +66,7 @@ class UriFactoryTest extends \PHPUnit\Framework\TestCase
public function testBuilder() public function testBuilder()
{ {
$uri = 'www.test-uri.com?id={@ID}&test={.mTest}&two={/path}&hash={#hash}&none=#none&found={/not}&v={/valid2}'; $uri = 'www.test-uri.com?id={@ID}&test={.mTest}&two={/path}&hash={#hash}&none=#none&found={/not}?v={/valid2}';
$vars = [ $vars = [
'@ID' => 1, '@ID' => 1,