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

Change subject: Don't cache replacement patterns in wfEscapeWikitext() during 
tests
......................................................................


Don't cache replacement patterns in wfEscapeWikitext() during tests

Parser tests depend upon being able to change the value of
$wgEnableMagicLinks at runtime, so skip caching the replacement patterns
while parser tests or phpunit tests are being run.

Change-Id: Ic9fe4fe898aa353bdefa2bf8207b77d2ac14887f
(cherry picked from commit 643b1b40a8f854695ea4e91281bb78c30d3ccd09)
---
M includes/GlobalFunctions.php
1 file changed, 3 insertions(+), 1 deletion(-)

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



diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 2b6088e..901581d 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -1668,7 +1668,9 @@
 function wfEscapeWikiText( $text ) {
        global $wgEnableMagicLinks;
        static $repl = null, $repl2 = null;
-       if ( $repl === null ) {
+       if ( $repl === null || defined( 'MW_PARSER_TEST' ) || defined( 
'MW_PHPUNIT_TEST' ) ) {
+               // Tests depend upon being able to change $wgEnableMagicLinks, 
so don't cache
+               // in those situations
                $repl = [
                        '"' => '&#34;', '&' => '&#38;', "'" => '&#39;', '<' => 
'&#60;',
                        '=' => '&#61;', '>' => '&#62;', '[' => '&#91;', ']' => 
'&#93;',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic9fe4fe898aa353bdefa2bf8207b77d2ac14887f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_28
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
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