PHPGangsta / GoogleAuthenticator

PHP class to generate and verify Google Authenticator 2-factor authentication
http://phpgangsta.de/4376
BSD 2-Clause "Simplified" License
2.23k stars 689 forks source link

Method verifyCode returns nothing #64

Open Johnny99211 opened 5 years ago

Johnny99211 commented 5 years ago

Since today I can't use verifyCode anymore. It returns nothing and there is no error. So maybe you can check it pls?

PHPGangsta commented 5 years ago

As you can see, I didn't change the code. Check your error.log file for any errors (Fatal errors or something?). Maybe you updated PHP?

As you can see in the code, verifyCode always returns true or false: https://github.com/PHPGangsta/GoogleAuthenticator/blob/master/PHPGangsta/GoogleAuthenticator.php#L125 "nothing" is not a valid return value :-D

ghost commented 5 years ago

I used it today. Seems to work fine.

Johnny99211 commented 5 years ago

Maybe a problem with the german summer time? Because we switched to summer time last weekend. Maybe the function don't checks that? Because when using time(), we're + 1 hour forward than the actual time (which is so stupid).

PHPGangsta commented 5 years ago

time() returns the unix timestamp, which is always GMT. Summer time does not affect that.

If it would be something with "wrong timezone": Then verifyCode would always return false. You said it's "nothing", which means NULL? Or what do you mean with "nothing"? Please make a var_dump() on the return value you get.

It's working fine here (I'm also from Germany). It must be something on your server that has changed (because the code did not change, and it is working since many years...).