jenkins-bot has submitted this change and it was merged.

Change subject: ApiExpandTemplates: Start parse before creating frame
......................................................................


ApiExpandTemplates: Start parse before creating frame

The code added in Id12cbe4a is creating a frame from the parser object
before actually starting a parse, meaning the frame ends up with no
title, which causes problems for other stuff that assumes the frame
*does* have a title.

While we could possibly change from calling ->preprocess() to
->recursivePreprocess() to avoid re-starting the parse, there are some
hooks called from ->preprocess() that it's probably best to continue
calling to not break BC.

Bug: 66798
Change-Id: If2ca8ab94ab81ee10f33ce1f4ee75655b7c1e680
(cherry picked from commit 682c7da095132703606c29375c00b70e6ebc297f)
---
M includes/api/ApiExpandTemplates.php
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Anomie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiExpandTemplates.php 
b/includes/api/ApiExpandTemplates.php
index eb3f87c..82d303f 100644
--- a/includes/api/ApiExpandTemplates.php
+++ b/includes/api/ApiExpandTemplates.php
@@ -89,6 +89,7 @@
                // if they didn't want any output except (probably) the parse 
tree,
                // then don't bother actually fully expanding it
                if ( $prop || $params['prop'] === null ) {
+                       $wgParser->startExternalParse( $title_obj, $options, 
OT_PREPROCESS );
                        $frame = $wgParser->getPreprocessor()->newFrame();
                        $wikitext = $wgParser->preprocess( $params['text'], 
$title_obj, $options, null, $frame );
                        if ( $params['prop'] === null ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/141416
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If2ca8ab94ab81ee10f33ce1f4ee75655b7c1e680
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.24wmf9
Gerrit-Owner: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to