Closed (fixed)
Project:
CAPTCHA
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Sep 2022 at 07:30 UTC
Updated:
6 Dec 2024 at 00:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
pguillard commentedComment #3
pguillard commentedComment #4
pguillard commentedComment #5
balintpekkerTested locally on Drupal 9.4.0 and Drupal 9.4.5 (the latest release), went through the steps to reproduce, and couldn't find any issue. Also checked the message in the issue description which implies that
\Drupal\Component\Utility\Html::escape($text)should be called somewhere in the CAPTCHA module with an empty$textbut I couldn't find any representation of such code, not even anything calling theescape()method.@pguillard Are you sure this is the module throwing the error message and not something else? Could you provide a little bit more information on the exact Drupal core version where this problem occurs?
Version information:
- CAPTCHA 1.4.0
- Drupal: 9.4.5
- PHP: 8.1.8
- MySQL: 8.0.23
- Server: nginx/1.19.7
Comment #6
balintpekkerAlso adding a full page screenshot of the status report page where the specified message is not present.
Comment #7
pandaski commentedHighly it is caused by this issue here https://www.drupal.org/project/captcha/issues/3293710
The steps to reproduce from the issue:
- Install PHP 8.1
- Install Captcha and Database Logging modules
- Enable both Captcha and Database Logging modules
- Navigate to admin/config/people/captcha/captcha-points
- Enable any existing captcha point without editing
- Navigate to admin/reports/dblog?type%5B%5D=php&severity%5B%5D=7
- A deprecated function message will be found.
What happened here is:
CAPTCHA point form ID is set to null by default and gives a deprecated function message in logs when enabled.
Inside the module, it has an addMessage function trying to read the label
'%label' => $this->entity->label()
but it is null by default - https://git.drupalcode.org/project/captcha/-/blob/8.x-1.x/config/install...
Ref: https://git.drupalcode.org/project/captcha/-/blob/8.x-1.x/src/Form/Captc...
Comment #8
japerryMarking as duplicate of #3293710: CAPTCHA point form ID is set to null
Comment #9
kaszarobertRelease 1.8 still produces for me this when using PHP 8.1. Initializing the variable to 0 manually fixed the problem:
drush php:eval "\Drupal::state()->set('captcha.wrong_response_counter', 0);"Comment #11
hswong3i commentedSimilar as #9 @kazarobert reported, now when running with PHP 8.3 + Drupal 11.0.4 + Captcha 2.0.x-dev, with following condition:
captcha.wrong_response_counternow return null)captcha_requirements()fromcaptcha.install)Will generate following PHP error message:
Simply patch as below could fix the problem:
Comment #15
ram4nd commentedTested that the patch works and solves the error on "Status report" page.
Comment #16
japerryGood catch hswong3i, committed!
Comment #18
japerry