News for hackers. Stuff that matters.
Re:Simple Way to Extract GET Params from a JavaScript Script... by staunch on Friday June 11, 2010 @10:19PM (#1425420)
Doesn't support multiple keys with the same name, which is valid and not particularly uncommon. I wouldn't be surprised if it breaks in other ways. This kind of thing is always full of subtle pitfalls.
Re:Simple Way to Extract GET Params from a JavaScript Script... by foobar2k on Friday June 11, 2010 @10:25PM (#1425434)
You'd normally use this script when you were in full control of the parameters you are passing, so its fairly easy to avoid this situation.
Re:Simple Way to Extract GET Params from a JavaScript Script... by aarlo on Friday June 11, 2010 @10:23PM (#1425431)
multiple keys with the same name? what do you mean? arrays?
Re:Simple Way to Extract GET Params from a JavaScript Script... by natrius on Friday June 11, 2010 @11:30PM (#1425495)
There's no such thing as parameter arrays. Any parameter name can have multiple values. PHP just happens to turn those into arrays. (I've never tried it in PHP with a parameter name that didn't have brackets at the end. It might not work in PHP.)

If you're familiar with Django, this is why the GET, POST and other request dictionaries are actually MultiValueDicts. If you call request.GET.getlist('varname') instead of request.GET['varname'], you'll get a list of each value passed with that name. The brackets aren't special, and if you used them, you'd need request.GET.getlist('varname[]').

Re:Simple Way to Extract GET Params from a JavaScript Script... by melvin on Friday June 11, 2010 @10:27PM (#1425437)
I think he means duplicate keys, as in '?id=4&color=8&id=6'