Page MenuHomePhabricator

'$wgOut->parse( "{{subst::test}}" );' does not seem to work
Closed, InvalidPublic

Description

Author: nickpj

Description:
Steps to reproduce; problem is step 5:

Step 1) Create a dummy page at [[test]].
Step 2) Edit index.php, and to the end add:

global $wgOut;
print $wgOut->parse( "[[test]]") ;

Step 3) View the wiki, and observe that a link to "test" is indeed added to the page footer.
Step 4) Edit index.php, and change the above two lines to read:

global $wgOut;
print $wgOut->parse( "{{subst::test}}" );

Step 5) View the wiki, and observe that rather than the contents of "test" being included, the output is the literal string "{{subst::test}}".
Step 6) Make a new wiki page, insert "{{subst::test}}", and save, to confirm that this wiki text as part of an article does include the contents of "test".

Please note that I am assuming that $wgOut->parse() is intended to handle arbitrary wiki text. If this is not the case, then this behaviour may be by-design, in which case please close this bug as Invalid.


Version: 1.11.x
Severity: minor

Details

Reference
bz10548

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:49 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz10548.
bzimport added a subscriber: Unknown Object (MLST).

Subst is a pre-save transform step, not a parse-time step.

ayg wrote:

(Also, surely there should be a single colon there and not two . . .)

ayg wrote:

(Er, right, it was a page in the main namespace, so that's correct. Never mind me.)

nickpj wrote:

Below is more along the lines of what I should have done, thanks to Simetrical:

$page_title = "test";
$title = Title::makeTitle( NS_MAIN, $page_title );
$revision = Revision::newFromTitle( $title );
$wgOut->addWikiText( $revision->getRawText() );