Page MenuHomePhabricator

DisplayFormat issue in documentation or code
Open, Needs TriagePublic

Description

With the (new) default configuration of Special:ContactPage, on core and extension head:

Notice: Undefined index: DisplayFormat in /var/wwwroot/wolfplex.be/www/w/extensions/ContactPage/ContactPage_body.php on line 204

Issue:
[39b3a9ec] /wiki/Sp%C3%A9cial:Contact MWException from line 360 of /var/wwwroot/wolfplex.be/www/w/includes/htmlform/HTMLForm.php: Display format must be one of Array

(
[0] => table
[1] => div
[2] => raw
[3] => inline
)

Stacktrace:

#0 /var/wwwroot/wolfplex.be/www/w/includes/htmlform/HTMLForm.php(267): HTMLForm->setDisplayFormat(NULL)
#1 /var/wwwroot/wolfplex.be/www/w/extensions/ContactPage/ContactPage_body.php(206): HTMLForm::factory(NULL, array, RequestContext, string)
#2 /var/wwwroot/wolfplex.be/www/w/includes/specialpage/SpecialPage.php(384): SpecialContact->execute(NULL)
#3 /var/wwwroot/wolfplex.be/www/w/includes/specialpage/SpecialPageFactory.php(553): SpecialPage->run(NULL)
#4 /var/wwwroot/wolfplex.be/www/w/includes/MediaWiki.php(249): SpecialPageFactory::executePath(Title, RequestContext)
#5 /var/wwwroot/wolfplex.be/www/w/includes/MediaWiki.php(678): MediaWiki->performRequest()
#6 /var/wwwroot/wolfplex.be/www/w/includes/MediaWiki.php(475): MediaWiki->main()
#7 /var/wwwroot/wolfplex.be/www/w/index.php(41): MediaWiki->run()
#8 {main}

Event Timeline

Dereckson raised the priority of this task from to Needs Triage.
Dereckson updated the task description. (Show Details)
Dereckson added subscribers: Dereckson, Reedy, daniel.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 10 2015, 1:48 PM

DisplayTable should be documented or a default value ("table" or "div" ?) should be offered.

Then, it requires also to set RLModules and RLStyleModules.

This has probably been introduced by Bryan Davis 2015-04-30 commits:

bd808 added a comment.Jul 10 2015, 4:08 PM

This has probably been introduced by Bryan Davis 2015-04-30 commits:

Both of those changes introduce default values in $wgContactConfig['default']:

  • 'DisplayFormat' => 'table',
  • 'RLModules' => array(), 'RLStyleModules' => array(),

SpecialContact::getTypeConfig() should be merging these defaults with the formType specific configuration. Have you possibly added local config via LocalSettings.php or similar that is clobbering the extension provided $wgContactConfig['default'] settings?

Change 224109 had a related patch set uploaded (by BryanDavis):
Add README documentation for DisplayFormat, RLModules and RLStyleModules

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

bd808 added a comment.Jul 10 2015, 4:31 PM

Thanks for pointing out the need for documentation updates. I had made the classic developer blunder of updating the code and adding comments without making the changes more visible to consumers.

Change 224109 merged by jenkins-bot:
Add README documentation for DisplayFormat, RLModules and RLStyleModules

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

Thanks for the documentation fix, yes it now works as expected.

To simplify this configuration block, what if we edit the code to add empty arrays if omitted?

Or if we do <default values array> + <array in settings>, so we keep sane default values, overwritten by the local config values?

bd808 added a comment.Jul 10 2015, 7:58 PM

Thanks for the documentation fix, yes it now works as expected.

To simplify this configuration block, what if we edit the code to add empty arrays if omitted?

Or if we do <default values array> + <array in settings>, so we keep sane default values, overwritten by the local config values?

I had not noticed before that the recommended way to configure the extension is to override all of the default settings provided by the extension. I think you're right that mixing in some sanity defaults at runtime could be useful.

Kghbln added a subscriber: Kghbln.EditedMar 23 2018, 6:20 PM

I got this with the following environment:

  • MediaWiki 1.27.4 (f581561) 16:58, 3. Mär. 2018
  • PHP 5.6.33-0+deb8u1 (apache2handler)
  • MySQL 5.5.59-0+deb8u1
  • ContactPage 2.2 (c139343) 00:45, 18. Mai 2016

However I found this to be one of the best failures ever seen for MediaWiki or an extension to it since it directly tell what you have to do to get rid of the issue.

I must note that I only got this because I left the configuration blanc for DisplayFormat

Kghbln updated the task description. (Show Details)Mar 23 2018, 6:22 PM