[php8-compat][NFC] Ensure that the 2nd parameter of hash_equals is a string in authx
authorSeamus Lee <seamuslee001@gmail.com>
Wed, 2 Jun 2021 21:48:57 +0000 (07:48 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Wed, 2 Jun 2021 21:48:57 +0000 (07:48 +1000)
ext/authx/Civi/Authx/Authenticator.php

index 49f103e8a1f6dfa7c7fc55343fce113bc1df4fb1..6fa9dd702b57ddf3408a0e44cb0eca460f8c41ae 100644 (file)
@@ -158,7 +158,7 @@ class Authenticator {
 
       // If any one of these passes, then we allow the authentication.
       $passGuard = [];
-      $passGuard[] = in_array('site_key', $useGuards) && defined('CIVICRM_SITE_KEY') && hash_equals(CIVICRM_SITE_KEY, $tgt->siteKey);
+      $passGuard[] = in_array('site_key', $useGuards) && defined('CIVICRM_SITE_KEY') && hash_equals(CIVICRM_SITE_KEY, (string) $tgt->siteKey);
       $passGuard[] = in_array('perm', $useGuards) && isset($perms[$tgt->credType]) && \CRM_Core_Permission::check($perms[$tgt->credType], $tgt->contactId);
       // JWTs are signed by us. We don't need user to prove that they're allowed to use them.
       $passGuard[] = ($tgt->credType === 'jwt');