From 7c199a872b20a5c126bebda085ced6aea12b1aeb Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sun, 21 Jun 2009 12:52:24 +0000 Subject: [PATCH] (bug 19323) Calls to recursiveTagParse() overwrite ParserOptions::$mSections, causing the real section tree to be overwritten in some cases --- RELEASE-NOTES | 2 ++ includes/parser/Parser.php | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0d45332070..4200dbd50b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -234,6 +234,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Added index, fromtitle and byteoffset fields to action=parse&prop=sections output * (bug 19313) action=rollback returns wrong revid on master/slave setups +* (bug 19323) action=parse doesn't return section tree on pages with Cite + warnings === Languages updated in 1.16 === diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 5fe307dc51..82c6af8b09 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -441,7 +441,7 @@ class Parser wfProfileIn( __METHOD__ ); wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) ); wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) ); - $text = $this->internalParse( $text ); + $text = $this->internalParse( $text, false ); wfProfileOut( __METHOD__ ); return $text; } @@ -862,8 +862,7 @@ class Parser * * @private */ - function internalParse( $text ) { - $isMain = true; + function internalParse( $text, $isMain = true ) { wfProfileIn( __METHOD__ ); $origText = $text; @@ -3691,7 +3690,6 @@ class Parser } $this->setOutputType( $oldType ); - $this->mOutput->setSections( $tocraw ); # Never ever show TOC if no headers if( $numVisible < 1 ) { @@ -3705,7 +3703,10 @@ class Parser $toc = $sk->tocList( $toc ); } - $this->mOutput->setTOCHTML( $toc ); + if ( $isMain ) { + $this->mOutput->setSections( $tocraw ); + $this->mOutput->setTOCHTML( $toc ); + } # split up and insert constructed headlines -- 2.20.1