Page MenuHomePhabricator

Error in HTMLForm when GrowthExperiments extension installed and site does not ask for an email address on Special:CreateAccount
Closed, ResolvedPublic

Description

Hi,
I installed GrowthExperiments extension on http://srwiki-dev.wmflabs.org for testing purposes. But I have problem. I asked on IRC, but no one answered on my question.

When user go on Special:CreateAccount, he gets this error:

[ad71c01a2c6d6769aedc3d43] /index.php?title=%D0%9F%D0%BE%D1%81%D0%B5%D0%B1%D0%BD%D0%BE:%D0%9E%D1%82%D0%B2%D0%BE%D1%80%D0%B8%D0%9D%D0%B0%D0%BB%D0%BE%D0%B3&returnto=%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B0 MWException from line 494 of /var/www/html/includes/htmlform/HTMLForm.php: Descriptor with no class for email: Array
(
[label-message] => growthexperiments-confirmemail-emailrecommended
[help-message] => growthexperiments-confirmemail-emailhelp
[helpInline] => 1
[tabindex] => 5
)
Backtrace:

#0 /var/www/html/includes/htmlform/HTMLForm.php(515): HTMLForm::getClassFromDescriptor(string, array)
#1 /var/www/html/includes/htmlform/VFormHTMLForm.php(43): HTMLForm::loadInputFromParameters(string, array, VFormHTMLForm)
#2 /var/www/html/includes/htmlform/HTMLForm.php(375): VFormHTMLForm::loadInputFromParameters(string, array, VFormHTMLForm)
#3 /var/www/html/includes/htmlform/HTMLForm.php(352): HTMLForm->addFields(array)
#4 /var/www/html/includes/htmlform/HTMLForm.php(310): HTMLForm->__construct(array, RequestContext)
#5 /var/www/html/includes/specialpage/LoginSignupSpecialPage.php(673): HTMLForm::factory(string, array, RequestContext)
#6 /var/www/html/includes/specialpage/AuthManagerSpecialPage.php(401): LoginSignupSpecialPage->getAuthForm(array, string)
#7 /var/www/html/includes/specialpage/LoginSignupSpecialPage.php(316): AuthManagerSpecialPage->trySubmit()
#8 /var/www/html/includes/specialpage/SpecialPage.php(575): LoginSignupSpecialPage->execute(NULL)
#9 /var/www/html/includes/specialpage/SpecialPageFactory.php(607): SpecialPage->run(NULL)
#10 /var/www/html/includes/MediaWiki.php(298): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#11 /var/www/html/includes/MediaWiki.php(967): MediaWiki->performRequest()
#12 /var/www/html/includes/MediaWiki.php(530): MediaWiki->main()
#13 /var/www/html/index.php(46): MediaWiki->run()
#14 {main}

Extension is added correctly in LocalSettings.php, per instructions on https://www.mediawiki.org/wiki/Extension:GrowthExperiments .


Version of MediaWiki: 1.35.0-alpha (e185eb2)
PHP: 7.3
http://srwiki-dev.wmflabs.org/index.php/Special:Version

Event Timeline

Restricted Application added subscribers: Petar.petkovic, Aklapper. · View Herald Transcript
Aklapper changed the task status from Open to Stalled.Dec 16 2019, 9:36 PM

https://phabricator.wikimedia.org/diffusion/EGRE/browse/master/includes/ConfirmEmailHooks.php$47 lists [label-message], [help-message], [helpInline]. There is no [tabindex] anywhere in the source code. @Zoranzoki21: Where does it come from in your configuration?

@Zoranzoki21: And I'm asking where your line [tabindex] => 5 comes from...

@Zoranzoki21: And I'm asking where your line [tabindex] => 5 comes from...

@Aklapper I really don't know, I just copied code from page and added in LocalSettings.php.

Aklapper changed the task status from Stalled to Open.Dec 16 2019, 11:20 PM
In T240903#5746170, @Zoranzoki21 wrote:

@Aklapper I really don't know, I just copied code and added in LocalSettings.php.

"just copied code from page" which page?

I installed the extension and could not reproduce the problem on the said version and master

$formDescriptor['email'] does not have a class associated with it; as for why, I don't know. Can you disable GrowthExperiments and post a screenshot of the Special:CreateAccount page here please?

You could also try something like:

if ( ( $formDescriptior['email']['class'] ?? null ) && !$config->get( 'EmailConfirmToEdit' ) ) {
[...]
}

Change 558455 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/extensions/GrowthExperiments@master] Check that formDescriptor email has a class before using

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

In T240903#5746170, @Zoranzoki21 wrote:

@Aklapper I really don't know, I just copied code and added in LocalSettings.php.

"just copied code from page" which page?

I installed the extension and could not reproduce the problem on the said version and master

I told already in comment, from page about extension on MediaWiki.org.

$formDescriptor['email'] does not have a class associated with it; as for why, I don't know. Can you disable GrowthExperiments and post a screenshot of the Special:CreateAccount page here please?

Sure:

image.png (900×1 px, 146 KB)

Can you disable GrowthExperiments and post a screenshot of the Special:CreateAccount page here please?

Sorry, I should have asked for ?uselang=en in the query :)

@Zoranzoki21 do you want to try the patch above on your srwiki-dev.wmflabs.org instance?

Can you disable GrowthExperiments and post a screenshot of the Special:CreateAccount page here please?

Sorry, I should have asked for ?uselang=en in the query :)

@Zoranzoki21 do you want to try the patch above on your srwiki-dev.wmflabs.org instance?

@kostajh Without patch (disabled extension):

image.png (900×1 px, 145 KB)

I tried patch, and works (same behaviour from previous screenshot).

Thanks for the screenshots and testing. Your wiki does not ask for email address on Special:CreateAccount, and our code assumed that this field would be there and defined (default behavior in MediaWiki). That's why this issue occurred.

Aklapper renamed this task from Special:CreateAccount no works when GrowthExperiments extension is installed to Error in HTMLForm when GrowthExperiments extension installed and site does not ask for an email address on Special:CreateAccount.Dec 17 2019, 11:53 AM

Thanks for the screenshots and testing. Your wiki does not ask for email address on Special:CreateAccount, and our code assumed that this field would be there and defined (default behavior in MediaWiki). That's why this issue occurred.

Oh, right. I will enable email later. Thanks for patch!

Change 558455 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] Check that formDescriptor email exists before using

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