http icon indicating copy to clipboard operation
http copied to clipboard

Multiple GET parameters of same name dropped from parsed query

Open finwe opened this issue 5 years ago • 1 comments

When creating a Nette\Http\Url object from a query with multiple GET parameters of a same name, only the last one is kept.

There is no standard regarding query parameters of the same name, many sites and tools, especially outside PHP world use the notation with multiple parameters of the same name. It'd be nice if Nette Url could correctly interpret these.

Steps To Reproduce

$url = new \Nette\Http\Url('https://www.example.com?filters=color-lightblue&filters=color-blue&filters=color-turquoise');
dump($url->getQuery()); // is ['filters' => 'color-turquoise']

Expected Behavior

The query property of the URL object should be an array of all three filters GET values, the same way as if filters[] notation were used.

Needs to be addressed

I see there is a potential of a BC break and maybe generating a URL string the same way - choosing the notation, maybe by setting a flag.

finwe avatar Apr 17 '20 09:04 finwe

I think the behavior should be the same as how PHP itself accesses the query parameters.

dg avatar Apr 02 '22 16:04 dg