antonioribeiro / google2fa

A One Time Password Authentication package, compatible with Google Authenticator.
MIT License
1.83k stars 199 forks source link

Update Google2FA.php #172

Open diadal opened 2 years ago

diadal commented 2 years ago

fix for Unsupported operand types: string + int

diadal commented 2 years ago

Like I said this never an issue before upgrading project dependents today. And making sure this $oldTimestamp converted to int is not a bad idea, but if you felt otherwise you can ignore the pull request

Sent from my iPhone

On Jan 21, 2022, at 9:24 PM, Markus Podar @.***> wrote:

 @mfn commented on this pull request.

In src/Google2FA.php:

@@ -231,7 +231,7 @@ private function makeStartingTimestamp($window, $timestamp, $oldTimestamp = null { return is_null($oldTimestamp) ? $timestamp - $this->getWindow($window)

  • : max($timestamp - $this->getWindow($window), $oldTimestamp + 1);
  • : max($timestamp - $this->getWindow($window), intval($oldTimestamp) + 1); I understand, but the whole code base documents it as int, so why are you having a string?

If the library moves to types, this would have to be removed because then it's not possible to have non-ints pass in so I asked, why do you have string in the first place?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.