summaryrefslogtreecommitdiffstats
path: root/app/classes
diff options
context:
space:
mode:
authorRomain d'Alverny <rdalverny@gmail.com>2022-01-11 12:26:15 +0100
committerRomain d'Alverny <rdalverny@gmail.com>2022-01-11 12:26:15 +0100
commit5f2b708377aec4bc5f1d731dfbb50557552d0482 (patch)
tree7faecd8bb938368bdb5ce825f716b8935ea10898 /app/classes
parent2b3469a29cb78f07500ea929dfae97570235cd9c (diff)
downloadplanet-5f2b708377aec4bc5f1d731dfbb50557552d0482.tar
planet-5f2b708377aec4bc5f1d731dfbb50557552d0482.tar.gz
planet-5f2b708377aec4bc5f1d731dfbb50557552d0482.tar.bz2
planet-5f2b708377aec4bc5f1d731dfbb50557552d0482.tar.xz
planet-5f2b708377aec4bc5f1d731dfbb50557552d0482.zip
Remove unneeded polyfills
Diffstat (limited to 'app/classes')
-rw-r--r--app/classes/Planet.php24
1 files changed, 2 insertions, 22 deletions
diff --git a/app/classes/Planet.php b/app/classes/Planet.php
index 5c6d7cf..d6007e5 100644
--- a/app/classes/Planet.php
+++ b/app/classes/Planet.php
@@ -75,29 +75,9 @@ class Planet
* @param string $supplied
* @return bool
*/
- public static function authenticateUser($known = '', $supplied = '')
+ public static function authenticateUser(string $known = '', string $supplied = '')
{
- // The hash_equals function was introduced in PHP 5.6.0. If it's not
- // existing in the current context (PHP version too old), and to ensure
- // compatibility with those old interpreters, we'll have to provide
- // an PHP implementation of this function.
- if (function_exists('hash_equals')) {
- return hash_equals($known, $supplied);
- }
-
- // Some implementation references can be found on the function comment.
- $knownLen = mb_strlen($known);
- if ($knownLen !== mb_strlen($supplied)) {
- return false;
- }
-
- // Ensure that all the characters are the same, and continue until the
- // end of the string even if an difference was found.
- for ($i = 0, $comparison = 0; $i < $knownLen; $i++) {
- $comparison |= ord($known[$i]) ^ ord($supplied[$i]);
- }
-
- return ($comparison === 0);
+ return hash_equals($known, $supplied);
}
/**