SemanticMediaWiki / SemanticMediaWiki

🔗 Semantic MediaWiki turns MediaWiki into a knowledge management platform with query and export capabilities
https://www.semantic-mediawiki.org
Other
515 stars 227 forks source link

InternalParseBeforeLinks.php: Argument 1 passed to ... must be of the type array, boolean given #2529

Closed zampaleu closed 7 years ago

zampaleu commented 7 years ago

Setup and configuration

Issue

Produces a stack trace and outputs:

Checking predefined properties ...
   ... space for internal properties already allocated.
   ... writing properties ...
   ... done.

Database initialized completed.

Import of vocabulary.json ...
   ... creating MediaWiki:Smw import skos contents ...
[8b061c90dc5f9a32dbc09662] [no req]   TypeError from line 54 of /var/www/llg/solab/extensions/SemanticMediaWiki/src/MediaWiki/Hooks/InternalParseBeforeLinks.php: Argument 1 passed to SMW\MediaWiki\Hooks\InternalParseBeforeLinks::setEnabledSpecialPage() must be of the type array, boolean given, called in /var/www/llg/solab/extensions/SemanticMediaWiki/src/MediaWiki/Hooks/HookRegistry.php on line 243

Backtrace

#0 /var/www/llg/solab/extensions/SemanticMediaWiki/src/MediaWiki/Hooks/HookRegistry.php(243): SMW\MediaWiki\Hooks\InternalParseBeforeLinks->setEnabledSpecialPage(boolean)
#1 /var/www/llg/solab/includes/Hooks.php(186): SMW\MediaWiki\Hooks\HookRegistry->SMW\MediaWiki\Hooks\{closure}(Parser, string, StripState)
#2 /var/www/llg/solab/includes/parser/Parser.php(1309): Hooks::run(string, array)
#3 /var/www/llg/solab/includes/parser/Parser.php(451): Parser->internalParse(string)
#4 /var/www/llg/solab/includes/content/WikitextContent.php(330): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL)
#5 /var/www/llg/solab/includes/content/AbstractContent.php(497): WikitextContent->fillParserOutput(Title, NULL, ParserOptions, boolean, ParserOutput)
#6 /var/www/llg/solab/includes/page/WikiPage.php(2071): AbstractContent->getParserOutput(Title, NULL, ParserOptions)
#7 /var/www/llg/solab/includes/page/WikiPage.php(1600): WikiPage->prepareContentForEdit(WikitextContent, NULL, User, string, boolean)
#8 /var/www/llg/solab/extensions/SemanticMediaWiki/src/Importer/ContentCreators/TextContentCreator.php(124): WikiPage->doEditContent(WikitextContent, string, integer)
#9 /var/www/llg/solab/extensions/SemanticMediaWiki/src/Importer/ContentCreators/TextContentCreator.php(108): SMW\Importer\ContentCreators\TextContentCreator->doCreateContent(Title, SMW\Importer\ImportContents)
#10 [internal function]: SMW\Importer\ContentCreators\TextContentCreator->SMW\Importer\ContentCreators\{closure}(integer)
#11 /var/www/llg/solab/includes/libs/rdbms/database/Database.php(2579): call_user_func_array(Closure, array)
#12 /var/www/llg/solab/includes/libs/rdbms/database/Database.php(2511): Wikimedia\Rdbms\Database->runOnTransactionIdleCallbacks(integer)
#13 /var/www/llg/solab/extensions/SemanticMediaWiki/src/MediaWiki/Database.php(594): Wikimedia\Rdbms\Database->onTransactionIdle(Closure)
#14 /var/www/llg/solab/extensions/SemanticMediaWiki/src/Importer/ContentCreators/TextContentCreator.php(109): SMW\MediaWiki\Database->onTransactionIdle(Closure)
#15 /var/www/llg/solab/extensions/SemanticMediaWiki/src/Importer/ContentCreators/DispatchingContentCreator.php(75): SMW\Importer\ContentCreators\TextContentCreator->doCreateFrom(SMW\Importer\ImportContents)
#16 /var/www/llg/solab/extensions/SemanticMediaWiki/src/Importer/Importer.php(112): SMW\Importer\ContentCreators\DispatchingContentCreator->doCreateFrom(SMW\Importer\ImportContents)
#17 /var/www/llg/solab/extensions/SemanticMediaWiki/src/Importer/Importer.php(87): SMW\Importer\Importer->doImportContents(SMW\Importer\ImportContents)
#18 /var/www/llg/solab/extensions/SemanticMediaWiki/src/MediaWiki/Hooks/HookRegistry.php(684): SMW\Importer\Importer->doImport()
#19 /var/www/llg/solab/includes/Hooks.php(186): SMW\MediaWiki\Hooks\HookRegistry->SMW\MediaWiki\Hooks\{closure}(SMW\SQLStore\TableBuilder\MySQLTableBuilder, Onoi\MessageReporter\ObservableMessageReporter)
#20 /var/www/llg/solab/extensions/SemanticMediaWiki/src/SQLStore/Installer.php(119): Hooks::run(string, array)
#21 /var/www/llg/solab/extensions/SemanticMediaWiki/includes/storage/SQLStore/SMW_SQLStore3.php(376): SMW\SQLStore\Installer->install(boolean)
#22 /var/www/llg/solab/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php(439): SMWSQLStore3->setup(boolean)
#23 /var/www/llg/solab/extensions/SemanticMediaWiki/maintenance/setupStore.php(91): SMW\Store::setupStore(boolean)
#24 /var/www/llg/solab/maintenance/doMaintenance.php(111): SMW\Maintenance\SetupStore->execute()
#25 /var/www/llg/solab/extensions/SemanticMediaWiki/maintenance/setupStore.php(169): require_once(string)
#26 /var/www/llg/solab/extensions/SemanticMediaWiki/maintenance/SMW_setup.php(9): require_once(string)
#27 {main}

Steps to reproduce the observation (recommendation is to use the sandbox):

php ./extensions/SemanticMediaWiki/maintenance/SMW_setup.php

mwjames commented 7 years ago

/SemanticMediaWiki/src/MediaWiki/Hooks/InternalParseBeforeLinks.php: Argument 1 passed to SMW\MediaWiki\Hooks\InternalParseBeforeLinks::setEnabledSpecialPage() must be of the type array, boolean given, called in /var/www/llg/solab/extensions/SemanticMediaWiki/src/MediaWiki/Hooks/HookRegistry.php

I'm guessing due to "Argument 1 passed to ... must be of the type array, boolean " that the smwgEnabledSpecialPage setting contains a boolean (true or false) and not the expected array as deployed with the default [0].

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/DefaultSettings.php#L981-L987

kghbln commented 7 years ago

In connenction with smwgEnabledSpecialPage only disabling it would make sense is a way, so I adapted the documentation to make clear how it is done.

@zampaleu If you could confirm that this was/is indeed the root of your issue...

zampaleu commented 7 years ago

I confirm, after disabling this feature the upgrade was successful $smwgEnabledSpecialPage = array( );

kghbln commented 7 years ago

Great and thanks a lot for your feedback. Yeah, false will not work.