The disablepp parameter of action=parse doesn't work, "NewPP limit report" still in output
Open, LowPublic

Description

When I try to remove the "NewPP limit report" from HTML returned by the API by adding &disablepp to the query, the output doesn't change. That is, it still contains the PP report even with &disablepp.

For example, the query

http://en.wikipedia.org/w/api.php?action=parse&format=jsonfm&page=User:Svick/Sandbox&prop=text&disablepp

currently returns something like:

{

"parse": {
    "title": "User:Svick/Sandbox",
    "text": {
        "*": "<p>Use <a rel=\"nofollow\" class=\"external text\" href=\"http://example.com\">THIS LINK</a> to contact the vendor.</p>\n\n\n<!-- \nNewPP limit report\nPreprocessor visited node count: 1/1000000\nPreprocessor generated node count: 4/1500000\nPost-expand include size: 0/2048000 bytes\nTemplate argument size: 0/2048000 bytes\nHighest expansion depth: 1/40\nExpensive parser function count: 0/500\n-->\n\n<!-- Saved in parser cache with key enwiki:pcache:idhash:15416342-0!*!*!*!*!*!* and timestamp 20130417193229 -->\n"
    }
}

}

The expectation is that the output shouldn't contain the "NewPP limit report" comment.


Version: 1.22.0
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=41354

Details

Reference
bz47333
bzimport raised the priority of this task from to Low.
bzimport set Reference to bz47333.
bzimport added a subscriber: Unknown Object (MLST).
Svick created this task.Apr 17 2013, 7:43 PM

More specifically, disablepp may be ignored when using oldid (where the specified revision id is the current revision) or page or pageid, due to MediaWiki fetching the ParserOutput from the parser cache.

This also implies that if the page isn't already cached, then this API query would cause the version without the limit report to be cached, which is also probably not the best thing.

So perhaps the thing to do is to have WikiPage::isParserCacheUsed return false if $parserOptions->getEnableLimitReport() is false.

onei added a comment.Mar 21 2014, 11:04 AM

Whilst the disablepp parameter does nothing when using the page parameter, it does have an effect when using the text parameter instead, see https://www.mediawiki.org/w/api.php?action=parse&text=[[foo]]&disablepp=true

However, the mere existence of the disablepp parameter removes the PP report, regardless of whether its set to false, or indeed anything at all: https://www.mediawiki.org/w/api.php?action=parse&text=[[foo]]&disablepp https://www.mediawiki.org/w/api.php?action=parse&text=[[foo]]&disablepp=bar

Save the limits report separately from HTML and append it in ParserOutput::getText()?

Svick added a comment.Mar 21 2014, 5:17 PM

(In reply to mdowdell from comment #2)

However, the mere existence of the disablepp parameter removes the PP
report, regardless of whether its set to false, or indeed anything at all

That's the normal behavior for all boolean parameters in the API.

(In reply to Svick from comment #4)

(In reply to mdowdell from comment #2)
> However, the mere existence of the disablepp parameter removes the PP
> report, regardless of whether its set to false, or indeed anything at all

That's the normal behavior for all boolean parameters in the API.

And I often write:

->request( array(

'..other..params..' => '..values..',
( $disablepp ? 'disablepp' : 'nodisablepp' ) => '',

) );

onei added a comment.Mar 22 2014, 1:25 AM

(In reply to Svick from comment #4)

(In reply to mdowdell from comment #2)
> However, the mere existence of the disablepp parameter removes the PP
> report, regardless of whether its set to false, or indeed anything at all

That's the normal behavior for all boolean parameters in the API.

I would expect it to show the PP report if disablepp was set to false, or rather anything that wasn't true. Ideally it should throw an error if it wasn't a boolean or what's the point of it being a boolean in the first place?

(In reply to mdowdell from comment #6)

(In reply to Svick from comment #4)
> (In reply to mdowdell from comment #2)
> > However, the mere existence of the disablepp parameter removes the PP
> > report, regardless of whether its set to false, or indeed anything at all
>
> That's the normal behavior for all boolean parameters in the API.

I would expect it to show the PP report if disablepp was set to false, or
rather anything that wasn't true. Ideally it should throw an error if it
wasn't a boolean or what's the point of it being a boolean in the first
place?

API "boolean" parameters work like checkboxes in HTML forms: If the box is checked, it sends whatever is defined as the value for the <input>. If the box is not checked, it sends nothing. So to determine if the checkbox was checked at the most basic level, you look for "was this parameter provided at all" without paying any attention to the value provided.

But this is offtopic for this bug report.

Anomie added a comment.May 5 2014, 2:05 PM
  • Bug 64860 has been marked as a duplicate of this bug. ***
Anomie moved this task from Unsorted to Needs Code on the MediaWiki-API board.Feb 19 2015, 7:04 PM