Last modified: 2014-04-29 14:13:08 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T12262, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 10262 - Change array types of queries to conform with normal HTTP GET query string
Change array types of queries to conform with normal HTTP GET query string
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 48903 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-14 23:05 UTC by Carl Fürstenberg
Modified: 2014-04-29 14:13 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Carl Fürstenberg 2007-06-14 23:05:37 UTC
Instead, of the current syntax, of having array-type attributes defined as key=val1|val2 etc... The normal behavior for a HTTP GET query string is key=val1&key=val2 etc... i.e. they key is duplicated for each value.
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-06-14 23:52:07 UTC
What standard specifies this as the normal behavior?
Comment 2 Carl Fürstenberg 2007-06-15 00:05:10 UTC
Just noticed, that for php to accept multiple same names, they must be followed by a [], as in:
<form method="get">
<input type="checkbox" value="a" name="foo[]" /><label for="foo">Foo</label><br/>
<input type="checkbox" value="b" name="foo[]" /><label for="bar">Bar</label><br/>
<input type="checkbox" value="c" name="foo[]" /><label for="baz">Baz</label><br/>
<input type="submit"/>
</form>

which will generate:
test.php?foo%5B%5D=a&foo%5B%5D=b&foo%5B%5D=c

and an array:
Array
(
    [foo] => Array
        (
            [0] => a
            [1] => b
            [2] => c
        )

)

from $_GET

perhaps this would be too cumbersome for the api.
Comment 3 Roan Kattouw 2007-06-15 10:18:58 UTC
Consider what this would mean when requesting a hundred titles:

api.php?action=query&prop=info&titles[]=a&titles[]=b&titles[]=c&...

versus:

api.php?action=query&prop=info&titles=a|b|c|...

The query string using the titles[] approach grows very long very quickly. Besides, converting an array to the a|b|c format is very easy with PHP's implode function.
Comment 4 Carl Fürstenberg 2007-06-15 11:02:38 UTC
(In reply to comment #3)
> Consider what this would mean when requesting a hundred titles:
> 
> api.php?action=query&prop=info&titles[]=a&titles[]=b&titles[]=c&...
> 
> versus:
> 
> api.php?action=query&prop=info&titles=a|b|c|...
> 
> The query string using the titles[] approach grows very long very quickly.
> Besides, converting an array to the a|b|c format is very easy with PHP's
> implode function.
> 

In that you are right. :)
Comment 5 Brad Jorsch 2014-04-28 21:00:13 UTC
*** Bug 48903 has been marked as a duplicate of this bug. ***
Comment 6 Brad Jorsch 2014-04-29 14:13:08 UTC
*** Bug 48903 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links