https://bugzilla.wikimedia.org/show_bug.cgi?id=33318

       Web browser: ---
             Bug #: 33318
           Summary: Internal call to ApiParse changes caller page
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: API
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: vladimir.kostu...@gmail.com
                CC: bryan.tongm...@gmail.com, roan.katt...@gmail.com,
                    s...@reedyboy.net, soxre...@gmail.com
    Classification: Unclassified


I am using ApiMain class in my own MediaWiki extension. 

I want to parse content of  some wiki pages from my site and I use ApiMain like
following:

$innerRequest = new ApiMain(new FauxRequest(array(
  "action" => "parse",
  "pageid" => 223,
  "prop" => "wikitext",
  "format" => "php"
)));

$innerRequest->execute();
$data = $innerRequest->getResultData();

And if I activate my extension in any page like: {{#my_own_extension:}} caller
page will change content (header, category) to parsed paged. Its behavior very
strange. 

I've found following code in ApiParse.php (method getParsedSectionOrText):

323 $pout = $articleObj->getParserOutput();
324       if ( $getWikitext ) {
325         $rev = Revision::newFromTitle( $titleObj );
326         if ( $rev ) {
327           $this->text = $rev->getText();
328         }
329       }
330       return $pout;

See line 323: method getParserOutput() uses global $wgParser and it changes
content of caller page. 

It seems to me that It should use clone of global parser (or instance) - not
original. Content of caller page shouldn't change.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to