Non-numeric value warning
mikeselander opened this issue · 0 comments
mikeselander commented
Hey folks, testing this plugin locally for potential use and I've noticed a couple of warnings that stem from type issues so figured I'd file issues as I find them.
There is a non-numeric value coming from user meta that is then used in an addition which is throwing warnings and kills the login if you have Xdebug setup.
The following line is putting out a string and casting it to an integer before use fixes the issue:https://github.com/dxw/2fa/blob/master/src/Tokens.php#L10
Stack traces:
( ! ) Warning: A non-numeric value encountered in /vagrant/content/client-mu-plugins/2fa/src/Tokens.php on line 13
--
1 | 0.0008 | 401536 | {main}( ) | .../wp-login.php:0
2 | 0.6921 | 9814616 | do_action( ) | .../wp-login.php:459
3 | 0.6921 | 9814992 | WP_Hook->do_action( ) | .../plugin.php:453
4 | 0.6921 | 9814992 | WP_Hook->apply_filters( ) | .../class-wp-hook.php:310
5 | 0.6921 | 9816120 | {closure:/vagrant/content/client-mu-plugins/2fa/lib/login.php:155-242}( ) | .../class-wp-hook.php:286
6 | 0.6931 | 9856720 | twofa_user_verify_token( ) | .../login.php:217
7 | 0.7096 | 9855944 | Dxw\TwoFa\Tokens->isValid( ) | .../helpers.php:87
( ! ) Warning: A non-numeric value encountered in /vagrant/content/client-mu-plugins/2fa/lib/helpers.php on line 316
--
1 | 0.0008 | 401536 | {main}( ) | .../wp-login.php:0
2 | 0.6921 | 9814616 | do_action( ) | .../wp-login.php:459
3 | 0.6921 | 9814992 | WP_Hook->do_action( ) | .../plugin.php:453
4 | 0.6921 | 9814992 | WP_Hook->apply_filters( ) | .../class-wp-hook.php:310
5 | 0.6921 | 9816120 | {closure:/vagrant/content/client-mu-plugins/2fa/lib/login.php:155-242}( ) | .../class-wp-hook.php:286
6 | 0.6931 | 9856720 | twofa_user_verify_token( ) | .../login.php:217
7 | 0.6962 | 9854224 | twofa_sms_verify_token( ) | .../helpers.php:82