- First commit to issue fork.
- ππ°Hong Kong hswong3i
Similar as #9 @kazarobert reported, now when running with PHP 8.3 + Drupal 11.0.4 + Captcha 2.0.x-dev, with following condition:
- Newly installed Drupal
- NONE of wrong response captcha, yet (i.e.
captcha.wrong_response_counter
now return null) - Enable "Enable statistics"
- Access Status Report page (i.e. trigger
captcha_requirements()
fromcaptcha.install
)
Will generate following PHP error message:
[Sun Sep 29 10:47:36 2024] Uncaught PHP Exception TypeError: "Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /home/hswong3i/Documents/drustack/composer-project-website-skeleton-11.0.x/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 256" at /home/hswong3i/Documents/drustack/composer-project-website-skeleton-11.0.x/core/lib/Drupal/Component/Utility/Html.php line 431
Simply patch as below could fix the problem:
diff --git a/captcha.install b/captcha.install index f8161f6..c68361a 100755 --- a/captcha.install +++ b/captcha.install @@ -97,7 +97,7 @@ function captcha_requirements($phase) { $requirements['captcha_wrong_response_counter'] = [ 'title' => \Drupal::translation()->translate('CAPTCHA'), 'value' => \Drupal::translation()->formatPlural( - \Drupal::state()->get('captcha.wrong_response_counter'), + \Drupal::state()->get('captcha.wrong_response_counter', 0), 'Already 1 blocked form submission', 'Already @count blocked form submissions' ),
- ππ°Hong Kong hswong3i
hswong3i β changed the visibility of the branch 3307927-php8.1-deprecated-function to hidden.
- ππ°Hong Kong hswong3i
hswong3i β changed the visibility of the branch 3307927-php8.1-deprecated-function to active.
- Merge request !98Issue #3307927 by pguillard, balintpekker, pandaski: [D11] php8.1 Deprecated... β (Merged) created by hswong3i
- πͺπͺEstonia ram4nd Tallinn
Tested that the patch works and solves the error on "Status report" page.
-
japerry β
committed 5570b0b4 on 2.x authored by
hswong3i β
Issue #3307927 by hswong3i: [D11] php8.1 Deprecated function :...
-
japerry β
committed 5570b0b4 on 2.x authored by
hswong3i β
- Status changed to Fixed
16 days ago 12:39am 6 December 2024 Automatically closed - issue fixed for 2 weeks with no activity.