Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple PHP warnings under PHP 8.1.27 #189

Open
ozgurkazancci opened this issue Feb 11, 2024 · 7 comments
Open

Multiple PHP warnings under PHP 8.1.27 #189

ozgurkazancci opened this issue Feb 11, 2024 · 7 comments

Comments

@ozgurkazancci
Copy link

PHP version: 8.1.27
Roundcube version: 1.6.6

Hi, and first of all, thanks for such a good idea/plugin. I have activated and enabled the plugin. Logged out to try it, however I got the following varying PHP warnings;

PHP Warning:  preg_match(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in /plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 7

PHP Warning:  preg_match(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in /plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 75

PHP Warning:  Trying to access array offset on value of type null in /plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 288
PHP Warning:  Trying to access array offset on value of type null in /plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 294
PHP Warning:  Trying to access array offset on value of type null in /plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 297
PHP Warning:  Trying to access array offset on value of type null in /plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 318
PHP Warning:  Trying to access array offset on value of type null in /plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 328
PHP Warning:  Trying to access array offset on value of type null in /plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 342

PHP Warning:  Undefined array key "twofactor_gauthenticator_2FA_login" in /plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 239

PHP Warning:  Trying to access array offset on value of type null in /plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 239

Just wanted to report these all here.

Regards.

@lukaszmarcola
Copy link

Hi, I've also checked all versions of php 8.* and a similar warning is returned on each of them:

[16-Feb-2024 09:28:30 Europe/Warsaw] PHP Warning: Undefined array key "twofactor_gauthenticator" in /var/www/html/roundcube/plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 413
[16-Feb-2024 09:28:30 Europe/Warsaw] PHP Warning: Trying to access array offset on value of type null in /var/www/html/roundcube/plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 131

Roundcube version: 1.6.6

@f1-outsourcing

This comment has been minimized.

@alexandregz
Copy link
Owner

not abandoned, just fake news 😸

@alexandregz
Copy link
Owner

alexandregz commented May 19, 2024

for example, looks her "opinion": he don't understand code -qr codes are generated locally using JS, easy to see- and try to call that others code, not only mine, is "crappy"

#194

Another one: #190 (comment)

@alexandregz
Copy link
Owner

About first comment: All this are just warnings because try to access to preferences first time, without prefs. You can skip these.

About second: I can't reproduce warnings (with php 8.0.8)

@CodeShakingSheep
Copy link

About first comment: All this are just warnings because try to access to preferences first time, without prefs. You can skip these.

About second: I can't reproduce warnings (with php 8.0.8)

These warnings appear from PHP 8.1 version onwards and should be fixed as in future PHP versions the affected code won't work anymore. I encounter these two warnings when running RoundCube and this plugin with PHP version 8.1.

[25-Jun-2024 01:54:54 UTC] PHP Warning:  Undefined array key "twofactor_gauthenticator_2FA_login" in /var/www/roundcube/plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 184
[25-Jun-2024 01:54:54 UTC] PHP Warning:  Undefined array key "twofactor_gauthenticator_login" in /var/www/roundcube/plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 184

@kam821
Copy link

kam821 commented Aug 10, 2024

These warnings appear from PHP 8.1 version onwards and should be fixed as in future PHP versions the affected code won't work anymore. I encounter these two warnings when running RoundCube and this plugin with PHP version 8.1.

These are unfortunately problems with plugins that are not production ready and are cobbled together so that they barely work.

Try changing line 184:
elseif($rcmail->task !== 'login' ! $_SESSION['twofactor_gauthenticator_2FA_login'] >= $_SESSION['twofactor_gauthenticator_login'])

into:
elseif($rcmail->task !== 'login' && isset($_SESSION['twofactor_gauthenticator_2FA_login']) && isset($_SESSION['twofactor_gauthenticator_login']) && ! $_SESSION['twofactor_gauthenticator_2FA_login'] >= $_SESSION['twofactor_gauthenticator_login'])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants