Problem/Motivation
Since the recent upgrade from Version 1.3 to 1.4 the following error message appears by trying to log in:
Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated in captcha_whitelist_ips_parse_values() (line 727 of modules/contrib/captcha/captcha.module).
Steps to reproduce
For the following system:
Ubuntu 20.04.4 LTS
Drupal 9.4.3
PHP 8.1.8
MariaDB 10.6.8
Upgrade using composer update. Present captcha Version 1.3 is upgraded to 1.4. Try to log in. => error message appears as mentioned above.
Proposed resolution
Fallback to captcha version 1.3
Remaining tasks
Check: line 727 of modules/contrib/captcha/captcha.module
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | fix-warning-message-3298766-6.patch | 383 bytes | cobenash |
Issue fork captcha-3298766
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
cobenashI have the same issue. Thanks for reporting.
Comment #6
cobenashPatch file provided.
Comment #7
kulturmensch commentedGreat! The fix works in my case and the warning disappeared. Thanks for the quick response!
Comment #8
simgui8 commented#5 looks good to me. Thanks
Comment #9
simgui8 commentedI have tested on dev and production sites.
The deprecation warning only happened with php8.1 (php8.1 added to issue title).
No warning with php8.0 or php7.4
The #5 MR (patch #6) fixes the issues with php8.1 and is fully compatible with php8.0 and php7.4
Marking RTBC since the patch is a one-liner and two people have reported that it fixes the issue.
Comment #10
simgui8 commentedAnd making it clear that passing null to parameter #1 is deprecated (not the trim function).
Comment #11
lapurddrupal commentedPatch #6 works fine. Thanks. Drupal Version 9.4.3 , PHP 8.1.7
Comment #12
Anonymous (not verified) commented#6 works here also. Drupal 9.4.3, PHP 8.1.8.
Thanks!
Comment #13
rymcveighPatch #6 works for us as well. Drupal Version 9.4.3, PHP 8.0.21
Comment #14
bserem commentedPatch #6 tested with D9.4.3 and PHP 8.1.7, all good
Comment #15
webfaqtory commentedPatch #6 tested with D9.4.5 and PHP 8.1.7, all good
Comment #16
pguillard commentedPatch #6 tested with D9.3.21 and PHP 8.1.7, all good too
Comment #17
eduardo morales albertiPatch #6 working, Drupal Version 9.4.5, PHP 8.1.7
Comment #18
klemendev commentedI think this is ready to be merged and released
Comment #19
zcht commentedDrupal 9.4.5, PHP 8.1.9 - patch #6 works again everything without problems and notice.
Comment #20
japerryFixed. it also highlighted an issue a line below, since we aren't checking nulls in line 731.
Comment #23
klemendev commentedUsing version 1.9, I still get this error logged:Passing null to parameter #1 ($string) of type string is deprecated in captcha_whitelist_ips_parse_values()EDIT: Reading old log, my mistake, all good :)