Needs review
Project:
CAPTCHA
Version:
2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Mar 2026 at 10:06 UTC
Updated:
4 Oct 2026 at 13:07 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
titacvetkovic commentedComment #5
velmir_taky commentedThank you @titacvetkovic for identifying and working on this issue! Your patch correctly addresses the core problems — the deprecated
FormElementclass and the missing: staticreturn types.I've built upon your work in the MR with a few adjustments:
What's kept from your patch:
-
FormElement=>FormElementBasereplacement inCaptcha.php- Added
: staticreturn type tocreate()methodsWhat's different:
- Preserved
new static()instead of changing tonew self()— this is the standard Drupal pattern for factory methods, as it supports late static binding and allows subclasses to work correctly- Kept the service calls inline in
create()methods — the constructors already have proper type hints, so intermediate variables with@varannotations aren't needed here- Extended the fix to 2 additional files that were missed:
CaptchaSettingsForm.phpandImageCaptchaSettingsForm.php(9 files total)All existing tests pass (2 unit, 4 kernel). PHPCS clean with Drupal + DrupalPractice standards.
Comment #6
anybodyThanks, this is important and LGTM. Let's wait for further feedback before merging.
Comment #7
jwilson3Would the changes in this MR allow the module to also be marked as D12 compatible?
I ask because the downstream module recaptcha_v3 has a dependency on this module, and had "NEXT_MAJOR" enabled in its .gitlab-ci.yml file, which is currently failing because captcha isnt yet marked as D12-compatible in captcha.info.yml
Related recaptcha_v3 issue #3580901: Pass GitLab CI pipeline.
Comment #8
anybodyDoesn't https://www.drupal.org/node/3436275 mean we need to set ^10.3 as minimum supported Drupal version?
Comment #9
anybody@jwilson3 would be great if you could review this to push D12 compatibility forward. Still we should have a dedicated issue for that.
PHPUnit (next major) still fails here, but yes let's do that in a different issue then, once this is fixed.
Comment #11
velmir_taky commentedPer #8: bumped
core_version_requirement to ^10.3 || ^11inboth info.ymlfiles (FormElementBase needs 10.3).D12 left for a separate issue per #9.
Comment #12
velmir_taky commentedComment #13
rajab natshahTested !132 on Drupal 11.4.8 and 12.0.0-beta1 (PHP 8.5): settings, image CAPTCHA, points and the math challenge on the login form work on both. On 12 it also needs the info.yml and RequirementSeverity parts of the bot MR !137. Looks good to me.