Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does position of parameters in a Query string affect the page?

Tags:

javascript

I have an application with most of the code written in javascript. I am encountering a strange problem. I have a query string and my app reads it to perform various actions. Yesterday I changed the ordering of the query string parameters and the application stopped working. If I put the original order back then it starts working. What could be the reason? I thought that the effect of ordering of parameters should not matter. But, apparently it does matter for some reason. I am still trying to dig out what can be the issue but wanted to know if any one here has encountered a similar problem?

Thanks.

like image 926
Blueboye Avatar asked Apr 04 '12 05:04

Blueboye


3 Answers

A properly written application will find a given query parameter in any order and will not be order sensitive. It is possible though to have poorly written parsing code that would only find a given parameter at the beginning, at the end, or only if after some other parameter. Without seeing the code that parses the query parameters, we can't really say what problem it has, but it is possible to have poorly written code that is position-sensitive.

If you post the code that parses the query parameters and the query string that works and the one that doesn't, we could advise more specifically. You should also check to make sure that your query parameters don't have any characters in them that are supposed to be encoded that could be throwing things off.

like image 189
jfriend00 Avatar answered Oct 19 '22 02:10

jfriend00


I have seen that kind of problem when the developer used the query string, as is, as a key to a cached object. When the query string changed, the key was not the same and the cache mechanism was failing (due to another bug).

like image 25
Simon Mourier Avatar answered Oct 19 '22 01:10

Simon Mourier


It should not be a problem. Something else causes the error. Or you have some dependencies on the location variable that contains the URL.

like image 31
Simon Edström Avatar answered Oct 19 '22 00:10

Simon Edström