From 53f5827ae5076ddb3c4f619e6354aa3f0797a4d9 Mon Sep 17 00:00:00 2001
From: csteipp <csteipp@wikimedia.org>
Date: Mon, 25 Apr 2016 15:46:14 -0700
Subject: [PATCH] SECURITY: Replace strip markers before syntax highlighting

The raw strip markers can't be syntax highlighted properly anyhow.

Bug: T51256, T110143, T78456
---
 SyntaxHighlight_GeSHi.class.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/SyntaxHighlight_GeSHi.class.php b/SyntaxHighlight_GeSHi.class.php
index 732f219..b933472 100644
--- a/SyntaxHighlight_GeSHi.class.php
+++ b/SyntaxHighlight_GeSHi.class.php
@@ -70,6 +70,10 @@ class SyntaxHighlight_GeSHi {
 	public static function parserHook( $text, $args = array(), $parser ) {
 		global $wgSyntaxHighlightDefaultLang, $wgUseTidy;
 		self::initialise();
+
+		// Replace strip markers (For e.g. {{#tag:syntaxhighlight|<nowiki>...}})
+		$text = $parser->mStripState->unstripNoWiki( $text );
+
 		$text = rtrim( $text );
 		// Don't trim leading spaces away, just the linefeeds
 		$text = preg_replace( '/^\n+/', '', $text );
-- 
2.6.6

