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

Parameters order with hash_equals #411

Merged

Conversation

chivincent
Copy link
Contributor

@chivincent chivincent commented Oct 17, 2022

There're 2 parameters in built-in function hash_equals, the first is "known_string" and second is "user_string".

The notes in PHP manual of hash_equals:

It is important to provide the user-supplied string as the second parameter, rather than the first.

Otherwise, there's a question in stackoverflow.com about Why is order of arguments in PHP's hash_equals() function important

In this commit, it changed parameter orders for hash_equals, because the "user_string" is provided by $this->route('id') and $this->route('hash').

This commit will not break any existing features because it only change the order of hash_equals().

There're 2 parameters in built-in function hash_equals, the first is
"known_string" and second is "user_string".

The notes in PHP manual of hash_equals:
> It is important to provide the user-supplied string as the second
> parameter, rather than the first.

Otherwise, there's a question in stackoverflow.com about [Why is order
of arguments in PHP's hash_equals() function important](https://stackoverflow.com/questions/27911597/why-is-order-of-arguments-in-phps-hash-equals-function-important)

In this commit, it changed paramenter orders for hash_equals, becuase
the "user_string" is provided by `$this->route('id')` and
`$this->route('hash')`.
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

Successfully merging this pull request may close these issues.

None yet

2 participants