alexandregz / twofactor_gauthenticator

This RoundCube plugin adds the 2-step verification(OTP) to the login proccess
MIT License
218 stars 76 forks source link

PHP Warning with Roundcube 1.5.2 and 8.0.14 #160

Open STR07 opened 2 years ago

STR07 commented 2 years ago

I get the following warnings when using Roudcube 1.5.2 and the plugin: twofactor_gauthenticator_login along with PHP 8.0.14.

[02-Jan-2022 20:51:58 Europe/Berlin] PHP Warning: Undefined array key "twofactor_gauthenticator" in /var/www/html/webmail/plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 416 [02-Jan-2022 20:51:58 Europe/Berlin] PHP Warning: Trying to access array offset on value of type null in /var/www/html/webmail/plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 193 [02-Jan-2022 20:51:58 Europe/Berlin] PHP Warning: Undefined array key "twofactor_gauthenticator" in /var/www/html/webmail/plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 416 [02-Jan-2022 20:51:58 Europe/Berlin] PHP Warning: Trying to access array offset on value of type null in /var/www/html/webmail/plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 129

These warnings occur after a login takes place.

Thank you very much in advance.

Ps: We are currently using version 2.0.0 of twofactor_gauthenticator_login

kenokallinger commented 2 years ago

We fixed this by using the code from the pull request 'Fixed PHP warnings and not working config options #157'

kenokallinger commented 2 years ago

Furthermore if you also get the following error: [05-Jan-2022 14:12:24 Europe/Berlin] PHP Warning: Undefined array key "HTTP_X_FORWARDED_FOR" in /var/www/html/webmail/plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 536

You can fix this by changing the statement: "$_SERVER['HTTP_X_FORWARDED_FOR']" to "getenv('HTTP_X_FORWARDED_FOR')"