nette/http

Multiple GET parameters of same name dropped from parsed query

finwe opened this issue · 1 comments

finwe commented

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.

dg commented

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