From: Kunal Mehta Date: Thu, 3 Nov 2016 18:50:44 +0000 (-0700) Subject: Don't cache replacement patterns in wfEscapeWikitext() during tests X-Git-Tag: 1.31.0-rc.0~4958^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=643b1b40a8f854695ea4e91281bb78c30d3ccd09;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index bae9c772e3..15a73cfc30 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1670,7 +1670,9 @@ function wfClientAcceptsGzip( $force = false ) { 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 = [ '"' => '"', '&' => '&', "'" => ''', '<' => '<', '=' => '=', '>' => '>', '[' => '[', ']' => ']',