sonata-project / GoogleAuthenticator

[Abandoned] Library to integrate Google Authenticator into a PHP project
https://github.com/sonata-project/GoogleAuthenticator
MIT License
436 stars 120 forks source link

prevent a float being passed to str_repeat #145

Closed paaaaaaaaaa closed 5 years ago

paaaaaaaaaa commented 5 years ago

Hot fix

This pull request will prevent php type casting a float when a integer is required. Resulting in the following fatal error.

PHP Fatal error: Uncaught TypeError: str_repeat() expects parameter 2 to be integer, float given...

This may happen when a custom secret is generated that is not 10 characters long.

I am targeting this branch because it is the current default.

Changelog

### Fixed
- prevent php casting to an incorrect type which will cause a fatal error
greg0ire commented 5 years ago

Hey there!

It looks like you did not fill the pull request template properly. Maybe you were confused, so let me walk you through this step by step.

Explaining why you target this branch

I am targeting this branch, because {reason}.

Here, you are supposed to replace {reason} with something like:

Filling the changelog

That one is really important to get right, because it will be used to craft a release changelog such as this one. The first thing you need to know about this is that if your pull request is pedantic, meaning it does not fix a bug for the user, or adds a new feature, it is not needed. This is typically the case for PRs that fix the build or add some documentation.

3 important things:

  1. Make sure to fill the changelog section with something directed at the end user, that answers the question "What benefit do I get from upgrading?".
  2. Make sure to remove empty sections.
  3. Make sure to keep the markdown markup.
core23 commented 5 years ago

Thanks @paaaaaaaaaa