AI-assisted by Codex. (review by jrockowitz)
Problem/Motivation
CAPTCHA 2.0.12 places the CAPTCHA administration helper under $form['elements']['captcha'], just before the webform actions. Webform's after-build callback only checks $form['captcha']['add_captcha'], so it returns early with the new placement and does not update the administration helper text and links.
Steps to reproduce
- Use Webform 6.3.x with CAPTCHA 2.0.12 and Image CAPTCHA enabled.
- Enable CAPTCHA administration mode.
- Visit a webform with a CAPTCHA element and a webform without one.
- Check whether the CAPTCHA administration helper text and links are updated.
Proposed resolution
Support both CAPTCHA form placements in third_party_settings/webform.captcha.inc, retaining compatibility with older CAPTCHA versions.
Remaining tasks
Review the proposed fix and run the CAPTCHA functional test.
User interface changes
None.
API changes
None.
Data model changes
None.
Test
WebformElementCaptchaTest passes on the updated 6.3.x checkout: 1 test, 4 assertions, no failures. PHPUnit reported 121 deprecations and 2 PHPUnit deprecations.
Issue fork webform-3635533
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
jrockowitz commentedAI-assisted by Codex (reviewed by jrockowitz)
From Codex
I reviewed MR !974 locally against Webform 6.2.x.
Webform 6.2.x is also impacted by CAPTCHA 2.0.12. Its after-build callback checks only `$form['captcha']['add_captcha']`, while CAPTCHA 2.0.12 places the administration helper under `$form['elements']['captcha']`.
Commit `f949cd747` applies cleanly to current `origin/6.2.x` with no conflicts. The resulting callback matches the 6.3.x fix, and both `php -l` and `git diff --check` pass.
The existing functional test could not complete locally because the Webform 6.2.x PHPUnit 9 stack treats PHP 8.5 PDO deprecations as errors before any assertions run.
Comment #6
jrockowitz commented