Skip to content
Snippets Groups Projects
Verified Commit d30fedcc authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3305807 by andypost, ChrisPerko, mediabounds, xjm, sorlov, Rishabh...

Issue #3305807 by andypost, ChrisPerko, mediabounds, xjm, sorlov, Rishabh Vishwakarma, ilya.no, asad_ahmed, paulocs, Michelle, _pratik_, reenaraghavan, DanChadwick, smustgrave, larowlan, allisonherodevs: Password is null if user has never logged in which causes PHP 8 warning

(cherry picked from commit 00a619f3)
parent 63cdabd2
No related branches found
No related tags found
20 merge requests!8376Drupal views: adding more granularity to the ‘use ajax’ functionality,!8300Issue #3443586 View area displays even when parent view has no results.,!7567Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7565Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7509Change label "Block description" to "Block type",!7344Issue #3292350 by O'Briat, KlemenDEV, hswong3i, smustgrave, quietone: Update...,!6922Issue #3412959 by quietone, smustgrave, longwave: Fix 12 'un' words,!6848Issue #3417553 by longwave: Remove withConsecutive() in CacheCollectorTest,!6720Revert "Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave:...,!6560Update ClaroPreRender.php, confirming classes provided are in array format,!6528Issue #3414261 by catch: Add authenticated user umami performance tests,!6501Issue #3263668 by omkar-pd, Wim Leers, hooroomoo: Re-enable inline form errors...,!6354Draft: Issue #3380392 by phma: Updating language weight from the overview reverts label if translated,!6324Issue #3416723 by Ludo.R: Provide a "node type" views default argument,!6119Issue #3405704 by Spokje, longwave: symfony/psr-http-message-bridge major version bump,!5950Issue #3403653 by alexpott, longwave: Incorporate improvements to how contrib runs PHPStan to core,!5858Issue #3401971 by fjgarlin: Test-only job shouldn't require constant rebases...,!5716Draft: Issue #3401102 by Spokje, longwave, smustgrave: Nightwatch artifacts on GitLab not retained,!5674Transaction autocommit during shutdown relies on unreliable object destruction order,!5644Issue #3395563 by nireneko, marvil07, lauriii, borisson_, smustgrave, Wim...
Pipeline #41229 canceled
Pipeline: drupal

#41238

    Pipeline: drupal

    #41237

      Pipeline: drupal

      #41236

        +1
        ......@@ -27,8 +27,8 @@ public function hash(#[\SensitiveParameter] $password);
        * Check whether a plain text password matches a hashed password.
        *
        * @param string $password
        * A plain-text password
        * @param string $hash
        * A plain-text password.
        * @param string|null $hash
        * A hashed password.
        *
        * @return bool
        ......@@ -46,7 +46,7 @@ public function check(#[\SensitiveParameter] $password, #[\SensitiveParameter] $
        * This method returns TRUE if the password was hashed with an older
        * algorithm.
        *
        * @param string $hash
        * @param string|null $hash
        * The hash to be checked.
        *
        * @return bool
        ......
        ......@@ -45,6 +45,10 @@ public function check(#[\SensitiveParameter] $password, #[\SensitiveParameter] $
        if (strlen($password) > static::PASSWORD_MAX_LENGTH) {
        return FALSE;
        }
        // Newly created accounts may have empty passwords.
        if ($hash === NULL || $hash === '') {
        return FALSE;
        }
        return password_verify($password, $hash);
        }
        ......
        ......@@ -242,6 +242,10 @@ public function hash(#[\SensitiveParameter] $password) {
        * {@inheritdoc}
        */
        public function check(#[\SensitiveParameter] $password, #[\SensitiveParameter] $hash) {
        // Newly created accounts may have empty passwords.
        if ($hash === NULL || $hash === '') {
        return FALSE;
        }
        if (substr($hash, 0, 2) == 'U$') {
        // This may be an updated password from user_update_7000(). Such hashes
        // have 'U' added as the first character and need an extra md5() (see the
        ......
        ......@@ -114,4 +114,14 @@ public function testPasswordRehashing() {
        $this->assertTrue($this->passwordHasher->check($this->password, $rehashed_password), 'Password check succeeds with re-hashed password with original hasher.');
        }
        /**
        * Tests password validation when the hash is NULL.
        *
        * @covers ::check
        */
        public function testEmptyHash(): void {
        $this->assertFalse($this->passwordHasher->check($this->password, NULL));
        $this->assertFalse($this->passwordHasher->check($this->password, ''));
        }
        }
        ......@@ -124,4 +124,14 @@ public function providerLongPasswords() {
        return $passwords;
        }
        /**
        * Tests password check in case provided hash is NULL.
        *
        * @covers ::check
        */
        public function testEmptyHash(): void {
        $this->assertFalse($this->passwordHasher->check($this->password, NULL));
        $this->assertFalse($this->passwordHasher->check($this->password, ''));
        }
        }
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment