https://bugzilla.wikimedia.org/show_bug.cgi?id=27942
--- Comment #4 from Brion Vibber <[email protected]> 2011-09-14 23:34:32 UTC --- It is permissible to have an argument appear multiple times, however *unless its name ends in "[]" PHP will just overwrite all the earlier ones with the later ones when it interprets input. Query string / POST elements whose names end in '[]' or '[<index>]' produce array elements, which may have either numeric or string keys. If you have [] on the end of the name, then it saves the one-or-more elements into an array with the name without the []. Within MediaWiki we fairly consistently use the associative-array model here, with sub-arrays for multiple items getting the [] added on the generated URL: > parse_str('a[]=b&a[]=c', $foo); var_export($foo); array ( 'a' => array ( 0 => 'b', 1 => 'c', ), ) > parse_str('a[xx]=b&a[yy]=c', $foo); var_export($foo); array ( 'a' => array ( 'xx' => 'b', 'yy' => 'c', ), ) > return wfArrayToCGI(array('a' => array('b', 'c'))); a%5B0%5D=b&a%5B1%5D=c > return wfArrayToCGI(array('a' => array('xx' => 'b', 'yy' => 'c'))); a%5Bxx%5D=b&a%5Byy%5D=c mw.Uri should probably model these similarly... $.param already seems to do this for serializing parameters into query strings: >>> $.param({a: "b"}); "a=b" >>> $.param({a: ["b", "c"]}); "a%5B%5D=b&a%5B%5D=c" >>> $.param({a: {xx: "b", yy: "c"}}); "a%5Bxx%5D=b&a%5Byy%5D=c" -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
