Page MenuHomePhabricator

boolean (url) variables are treated differently by the api depending on if POST or GET is used
Closed, ResolvedPublic

Description

I'm not 100% sure if this is even if this is a bug or not (And if it is, it might be a php/apache bug, not a mediawiki bug), but it confused me for a little bit.

Basically, make a GET request like http://example.com/api.php?action=query&prop=revisions&titles=Main%20Page&rvprop=content&rvgeneratexml

It works as expected. Now try POSTing the equivelent (with a content-type of application/x-www-form-urlencoded): action=query&prop=revisions&titles=Main%20Page&rvprop=content&rvgeneratexml

It doesn't work unless you have an = sign after the rvgeneratexml. This is especially confusing because in the example given for the edit module it gives the example action=edit&title=Test&summary=NOTOC&minor&prependtext=NOTOC%0A&basetimestamp=20070824123454&token=%2B\

Which won't be marked as minor if POSTed.

(I discovered this trying to figure out why my bot's edit wasn't being marked as bot. I was doing my testing using wget if it matters.).


Version: 1.16.x
Severity: trivial

Details

Reference
bz25174

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:19 PM
bzimport set Reference to bz25174.

Bryan.TongMinh wrote:

Let's just add the equal sign to the examples.

Are you going to do this Bryan? :P

Bryan.TongMinh wrote:

uhhh no? :p

Has anyone figured out why this was happening though? Is that a MW feature or PHP? It would be better to make the MW understand both.

(In reply to comment #5)

Has anyone figured out why this was happening though? Is that a MW feature or
PHP? It would be better to make the MW understand both.

It's PHP. As far as I can tell, way back in 2000 (a6393de6 in PHP's git) they split their code for POST handling from that for GET handling. Then in 2002 (92e542db) they fixed the fact that foo.php?x&y&z wouldn't register x or y or z, but didn't make the analogous change for the POST handling. I didn't see any reference to a bug in their bug tracker.