Make WordPress Core

Changeset 39697


Ignore:
Timestamp:
01/05/2017 08:17:19 AM (8 years ago)
Author:
dd32
Message:

Upgrade/Install: Avoid creating nonce during installation.

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 isn't available during installation, we can safely skip creating a nonce.

Props nullvariable, pento, dd32, rmccue.
Merges [39684] to the 4.7 branch.
Fixes #39047.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

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

    r39323 r39697  
    508508    did_action( 'init' ) && $scripts->localize( 'wp-api', 'wpApiSettings', array(
    509509        'root'          => esc_url_raw( get_rest_url() ),
    510         'nonce'         => wp_create_nonce( 'wp_rest' ),
     510        'nonce'         => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
    511511        'versionString' => 'wp/v2/',
    512512    ) );
Note: See TracChangeset for help on using the changeset viewer.