Page MenuHomePhabricator

Class "ReCaptchaNoCaptcha" not found
Closed, ResolvedPublicBUG REPORT

Description

After upgrade to MW 1.43 the $wgCaptchaClass must be defined with the full namespace:

in my case $wgCaptchaClass = 'ReCaptchaNoCaptcha'; must be:
$wgCaptchaClass = 'MediaWiki\\Extension\\ConfirmEdit\\ReCaptchaNoCaptcha\\ReCaptchaNoCaptcha';

if not doing this I have stack that says that class isn't definied.

other users have this problem:
https://www.mediawiki.org/wiki/Extension_talk:ConfirmEdit

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
MediaWiki 1.43.3
PHP 8.3.21 (fpm-fcgi)
ICU 70.1
MySQL 5.7.44-48-log

Other information (browser name/version, screenshots, etc.):

Chrome Version 137.0.7151.122 (Official Build) (64-bit)

Event Timeline

It looks like a class_alias() call wasn't added when the ReCaptchaNoCaptcha class was originally namespaced in December 2022 / REL1_40: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ConfirmEdit/+/778564/15/ReCaptchaNoCaptcha/includes/ReCaptchaNoCaptcha.php (given @matmarex's comment on patchset 12, potentially due to an unintentional oversight?)

If my understanding is correct, the issue in this task may have been solved for ConfirmEdit (CAPTCHA extension) with fb0423a1a8 (which has now been backported to REL1_44 [ced63dd098] & REL1_43 [39479e3473]).

Although, given that it seems like MediaWiki-extensions-ConfirmAccount might use the same $wgCaptchaClass config variable as ext:ConfirmEdit (T384064#11109440, cc @Kghbln), maybe we might also want to retrospectively add a class_alias for ReCaptchaNoCaptcha as well?

We should fix ConfirmAccount then probably in a similar way…

Adding alias’s which aren’t needed by ConfirmEdit because of the mapping, makes it just more tech debt to remove the aliases again afterwards

Yeah, ConfirmAccount is directly accessing $wgCaptchaClass, when it really shouldn't access another do so... Fix is relatively easy.

Change #1181113 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/ConfirmAccount@master] Stop accessing $wgCaptchaClass directly

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

Change #1181113 merged by jenkins-bot:

[mediawiki/extensions/ConfirmAccount@master] Stop accessing $wgCaptchaClass directly

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

Change #1182544 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/ConfirmAccount@REL1_44] Stop accessing $wgCaptchaClass directly

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

Change #1182547 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/ConfirmAccount@REL1_43] Stop accessing $wgCaptchaClass directly

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

Change #1182544 merged by jenkins-bot:

[mediawiki/extensions/ConfirmAccount@REL1_44] Stop accessing $wgCaptchaClass directly

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

Reedy claimed this task.

Change #1182547 merged by jenkins-bot:

[mediawiki/extensions/ConfirmAccount@REL1_43] Stop accessing $wgCaptchaClass directly

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