Make WordPress Core

Changeset 51546


Ignore:
Timestamp:
08/05/2021 12:31:20 AM (3 years ago)
Author:
peterwilsoncc
Message:

Upgrade/Install: Avoid creating nonce during installation.

This avoids a "Table wp_options doesn't exist" database error when trying to create a nonce for password reset button.

When installing and using database-saved salts, wp_create_nonce() causes database errors as wp_salt() attempts to insert into the not-yet-created options table. Since authentication is not available during installation, we can safely skip creating a nonce.

Follow-up to [39684], [50129].

Props schlessera, swissspidy, sanketchodavadiya, hellofromTonya, SergeyBiryukov.
Merges [51525] to the 5.8 branch.
Fixes #53830.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-includes/script-loader.php

    r51505 r51546  
    10981098        array(
    10991099            'user_id' => $user_id,
    1100             'nonce'   => wp_create_nonce( 'reset-password-for-' . $user_id ),
     1100            'nonce'   => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'reset-password-for-' . $user_id ),
    11011101        )
    11021102    );
Note: See TracChangeset for help on using the changeset viewer.