Last modified: 2014-05-05 14:05:11 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 T49333, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 47333 - The disablepp parameter of action=parse doesn't work, "NewPP limit report" still in output
The disablepp parameter of action=parse doesn't work, "NewPP limit report" st...
Status: NEW
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.22.0
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 64860 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-17 19:43 UTC by Svick
Modified: 2014-05-05 14:05 UTC (History)
9 users (show)

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


Attachments

Description Svick 2013-04-17 19:43:24 UTC
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.
Comment 1 Brad Jorsch 2013-04-19 14:01:57 UTC
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.
Comment 2 mdowdell 2014-03-21 11:04:41 UTC
Whilst the disablepp parameter does nothing when using the page parameter, it does have an effect when using the text parameter instead, see foo]]&disablepp=true">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: foo]]&disablepp">https://www.mediawiki.org/w/api.php?action=parse&text=[[foo]]&disablepp foo]]&disablepp=bar">https://www.mediawiki.org/w/api.php?action=parse&text=[[foo]]&disablepp=bar
Comment 3 Max Semenik 2014-03-21 11:12:57 UTC
Save the limits report separately from HTML and append it in ParserOutput::getText()?
Comment 4 Svick 2014-03-21 17:17:51 UTC
(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.
Comment 5 Liangent 2014-03-21 17:31:29 UTC
(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' ) => '',
) );
Comment 6 mdowdell 2014-03-22 01:25:32 UTC
(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?
Comment 7 Brad Jorsch 2014-03-24 15:37:04 UTC
(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.
Comment 8 Brad Jorsch 2014-05-05 14:05:11 UTC
*** Bug 64860 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