mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-24 00:05:00 +00:00
Don't fall back to global $wgUser when creating ParserOptions
Pass a user when relevant, or use ParserOptions::newFromAnon() Bug: T246861 Change-Id: I44adb6d5c037de2fb05573cde3c7356cb73e8b42
This commit is contained in:
parent
f5c78fba8d
commit
fb850e853c
|
@ -95,7 +95,7 @@ class ApiScribuntoConsole extends ApiBase {
|
|||
*/
|
||||
protected function runConsole( array $params ) {
|
||||
$parser = MediaWikiServices::getInstance()->getParser();
|
||||
$options = new ParserOptions;
|
||||
$options = new ParserOptions( $this->getUser() );
|
||||
$parser->startExternalParse( $params['title'], $options, Parser::OT_HTML, true );
|
||||
$engine = Scribunto::getParserEngine( $parser );
|
||||
try {
|
||||
|
|
|
@ -45,7 +45,12 @@ trait Scribunto_LuaEngineTestHelper {
|
|||
|
||||
try {
|
||||
$parser = new Parser;
|
||||
$parser->startExternalParse( Title::newMainPage(), new ParserOptions, Parser::OT_HTML, true );
|
||||
$parser->startExternalParse(
|
||||
Title::newMainPage(),
|
||||
ParserOptions::newFromAnon(),
|
||||
Parser::OT_HTML,
|
||||
true
|
||||
);
|
||||
$engineClass = "Scribunto_{$engineName}Engine";
|
||||
$engine = new $engineClass(
|
||||
self::$engineConfigurations[$engineName] + [ 'parser' => $parser ]
|
||||
|
@ -119,7 +124,7 @@ trait Scribunto_LuaEngineTestHelper {
|
|||
protected function getEngine() {
|
||||
if ( !$this->engine ) {
|
||||
$parser = new Parser;
|
||||
$options = new ParserOptions;
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$options->setTemplateCallback( [ $this, 'templateCallback' ] );
|
||||
$parser->startExternalParse( $this->getTestTitle(), $options, Parser::OT_HTML, true );
|
||||
$class = "Scribunto_{$this->engineName}Engine";
|
||||
|
|
|
@ -26,7 +26,7 @@ class Scribunto_LuaEnvironmentComparisonTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
private function makeEngine( $class, $opts ) {
|
||||
$parser = new Parser;
|
||||
$options = new ParserOptions;
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$options->setTemplateCallback( [ $this, 'templateCallback' ] );
|
||||
$parser->startExternalParse( Title::newMainPage(), $options, Parser::OT_HTML, true );
|
||||
$engine = new $class ( [ 'parser' => $parser ] + $opts );
|
||||
|
|
Loading…
Reference in a new issue