API: Use U+001F (Unit Separator) for separating multi-valued parameters
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 16 Aug 2016 20:36:27 +0000 (16:36 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Mon, 29 Aug 2016 15:00:25 +0000 (11:00 -0400)
commit75a85b412c4adb86d3cea6986a4c0394f7a531be
tree7c5fb86c2524578dfa3c795a5aa167d6495a1c36
parent87c069c801589a721b4efb9b024ce71e977fe3fa
API: Use U+001F (Unit Separator) for separating multi-valued parameters

When a multi-valued parameter's value begins with U+001F, the values
will be split on that character instead of pipes. This will be useful
for things such as action=options&change= or meta=allmessages&amargs=.
Since MediaWiki doesn't otherwise accept C0 control characters
(WebRequest::getVal() replaces them with �), there's no possibility that
this will conflict with a literal use of U+001F.

Special:ApiSandbox and mw.Api are updated to make use of this, with the
latter having an option to disable the behavior in case something is
depending on [ 'foo', 'bar|baz' ] turning into 'foo|bar|baz'.

Pipe is still used as the separator when the value doesn't begin with
U+001F, and will be forever since it's generally more human-friendly and
is needed for backwards compatibility with basically every API client in
existence. The requirement that the value begin with U+001F, rather than
simply contain U+001F, is to avoid clients having to somehow
special-case "param=foo|bar" where that's intended to be a single value
"foo|bar" rather than two values "foo" and "bar".

Bug: T141960
Change-Id: I45f69997667b48887a2b67e93906364a652ace5a
RELEASE-NOTES-1.28
includes/WebRequest.php
includes/api/ApiBase.php
includes/api/i18n/en.json
resources/src/mediawiki.special/mediawiki.special.apisandbox.js
resources/src/mediawiki/api.js
resources/src/mediawiki/api/options.js
tests/phpunit/includes/api/ApiBaseTest.php
tests/phpunit/includes/api/MockApi.php
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.options.test.js