Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect parsing of query strings #4

Open
papercreatures opened this issue Feb 22, 2013 · 7 comments
Open

Incorrect parsing of query strings #4

papercreatures opened this issue Feb 22, 2013 · 7 comments

Comments

@papercreatures
Copy link

it is perfectly valid to have ?a=1&a=2 unfortunately as it uses a dictionary internally, these get squashed. i'll try and patch next week.

@radmen
Copy link
Owner

radmen commented Feb 22, 2013

So what value should be under a key? In PHP $_GET['a'] will return 2 (Miuri also returns 2).
I believe it's valid behavior.

@papercreatures
Copy link
Author

PHP is broken then, but we all knew that.

On Friday, 22 February 2013, Radosław Mejer wrote:

So what value should be under a key? In PHP $_GET['a'] will return 2(Miuri also returns
2).
I believe it's valid behavior.


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-13962558.

@radmen
Copy link
Owner

radmen commented Feb 23, 2013

Ok, so what is the correct value then? Can You give something like RFC to show the right way?

@papercreatures
Copy link
Author

The correct value would be for miuri to not delete duplicate params when parsing. i.e
new Miuri("http://a.com?a=2&a=3') should not become http://a.com?a=2 when toString is called.

I'm not sure how you would make a backward compatible change to the query function in order to make it possible to set multiples though. jQuery uses a name, value dictionary.

@radmen
Copy link
Owner

radmen commented Feb 24, 2013

I'm not sure how you would make a backward compatible change to the query function in order to make it possible to set multiples though.

Are You talking about arrays passed in GET (something like a[]=2&a[]=3)?

@papercreatures
Copy link
Author

Yes, but that's just a hacky workaround PHP does. its perfectly valid to do a=1&a=2 sans square brackets

@radmen
Copy link
Owner

radmen commented Feb 25, 2013

I searched a little at Google. You're right about passing arrays without brackets (didn't know that..).
Yet it's not a common thing. jQuery e.g uses brackets (I've used $.param to check it).

Parsing query string to find arrays without brackets won't be much a problem.
Building URI with arrays in query is a little bit tricky, because programmer will have to choose which option (brackets or no brackets) to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant