QINU fix

Some extensions that parse WikiMarkup return strings similar to "UNIQ7dcd9aca33200a81-example-14c1dc322856b22b00000001-QINU" instead of returning what they're supposed to. This seems to be a bug with using  to access the parser. In MediaWiki 1.6.8 or above, the parser object is passed to the extension callback function. By using that object, you can solve the problem.

For example, this code may break (it seems inconsistent, or at least in my tests) setHook( "example", "exampleExtension" ); }

function exampleExtension( $input, $argv, $parser = null ) { # do some stuff

global $wgOut; $output = $wgOut->parse($stuff_to_parse, true); return output; } ?>

The following  function fixes the problem in most cases: function exampleExtension( $input, $argv, &$parser ) { # do some stuff

$output = $parser->parse($stuff_to_parse, $parser->mTitle, $parser->mOptions, true, false); return $output->getText; }

The above code will add  around your output. To disable this, just change the second to last line to: $output = $parser->parse($stuff_to_parse, $parser->mTitle, $parser->mOptions, false, false);

However, this won't work with newer versions of MediaWiki (1.6.7?) if you call it more than once. Instead, instantiate a new parser altogether:

function myHook($input, $argv, &$parser) {    $localParser = new Parser; $output = $localParser->parse($input, $parser->mTitle, $parser->mOptions); $text = $output->getText; }

I haven't tested this with the backward-compatibility described on MediaWiki extensions FAQ, but it seems like it should work.

In general, it seems like a better idea to use the $parser than the global $wgOut object.