4343use function hash_equals ;
4444use function hash_hmac ;
4545use function is_numeric ;
46+ use function is_scalar ;
4647use function password_hash ;
4748use function password_needs_rehash ;
4849use function password_verify ;
@@ -498,14 +499,15 @@ private function purgeHashCookies(?string $skipCookie = null)
498499 $ sp = session_get_cookie_params ();
499500 $ killTime = time () - 3600 ;
500501 foreach ($ _COOKIE as $ cookieName => $ value ) {
501- if ($ cookieName !== $ skipCookie && strpos ($ cookieName , self ::COOKIE_HASH_PREFIX ) !== false ) {
502+ if ($ cookieName !== $ skipCookie && is_scalar ( $ cookieName ) && strpos (( string ) $ cookieName , self ::COOKIE_HASH_PREFIX ) !== false ) {
502503 setcookie ($ cookieName , '' , $ killTime , '/ ' , $ sp ['domain ' ], false , true );
503504 }
504505 }
505506 }
506507
507508 /**
508509 * @param User $user Used by some password checkers to provide better checking
510+ *
509511 * @throws WeakPasswordException
510512 */
511513 private function enforcePasswordStrength (string $ password , User $ user )
@@ -521,6 +523,7 @@ private function enforcePasswordStrength(string $password, User $user)
521523 *
522524 * @param User $user The user to whom this password gets assigned
523525 * @param string $newPassword Cleartext password that's being hashed
526+ *
524527 * @throws NoSuchUserException
525528 * @throws WeakPasswordException
526529 */
@@ -544,6 +547,7 @@ public function resetPassword(User $user, string $newPassword)
544547 *
545548 * @param User $user The user to validate password for
546549 * @param string $password Cleartext password that'w will be verified
550+ *
547551 * @throws PersistedUserRequiredException
548552 * @throws UserWithoutAuthenticationRecordException
549553 */
0 commit comments