Page MenuHomePhabricator

convertToText.php: TypeError: Argument 1 passed to Parser::setOptions() must be an instance of ParserOptions, null given
Closed, ResolvedPublic

Description

When trying to convert a Flow-based page to wikitext, the following happens:

[urbanecm@mwmaint2002 ~]$ mwscript extensions/Flow/maintenance/convertToText.php --wiki=mediawikiwiki --page=Talk:Growth

*******************************************************************************
NOTE: Do not run maintenance scripts directly, use maintenance/run.php instead!
      Running scripts directly has been deprecated in MediaWiki 1.40.
      It may not work for some (or any) scripts in the future.
*******************************************************************************

[6b74e1a55e354424be90d61e] [no req]   TypeError: Argument 1 passed to Parser::setOptions() must be an instance of ParserOptions, null given, called in /srv/mediawiki/php-1.40.0-wmf.26/extensions/Flow/maintenance/convertToText.php on line 240
Backtrace:
from /srv/mediawiki/php-1.40.0-wmf.26/includes/parser/Parser.php(1111)
#0 /srv/mediawiki/php-1.40.0-wmf.26/extensions/Flow/maintenance/convertToText.php(240): Parser->setOptions(NULL)
#1 [internal function]: Flow\Maintenance\ConvertToText->getSignature(User)
#2 /srv/mediawiki/php-1.40.0-wmf.26/extensions/Flow/maintenance/convertToText.php(362): array_map(array, array)
#3 /srv/mediawiki/php-1.40.0-wmf.26/extensions/Flow/maintenance/convertToText.php(315): Flow\Maintenance\ConvertToText->processMultiRevisions(array, boolean, string)
#4 /srv/mediawiki/php-1.40.0-wmf.26/extensions/Flow/maintenance/convertToText.php(61): Flow\Maintenance\ConvertToText->processHeader()
#5 /srv/mediawiki/php-1.40.0-wmf.26/maintenance/includes/MaintenanceRunner.php(609): Flow\Maintenance\ConvertToText->execute()
#6 /srv/mediawiki/php-1.40.0-wmf.26/maintenance/doMaintenance.php(99): MediaWiki\Maintenance\MaintenanceRunner->run()
#7 /srv/mediawiki/php-1.40.0-wmf.26/extensions/Flow/maintenance/convertToText.php(407): require_once(string)
#8 /srv/mediawiki/multiversion/MWScript.php(118): require_once(string)
#9 {main}
[urbanecm@mwmaint2002 ~]$

Commenting-out convertToText.php:240 seems to avoid the issue. I don't understand why the script first calls $old = $parser->getOptions(); followed by a $parser->setOptions( $old );.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 898674 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/Flow@master] convertToText.php: Use fresh parser for signature

https://gerrit.wikimedia.org/r/898674

kostajh triaged this task as Medium priority.Mar 16 2023, 11:24 AM

Change 898674 merged by jenkins-bot:

[mediawiki/extensions/Flow@master] convertToText.php: Use fresh parser for signature

https://gerrit.wikimedia.org/r/898674

Urbanecm_WMF assigned this task to Tgr.

Verified at mwmaint2002.