WordPress.org

Make WordPress Core

Changeset 39684


Ignore:
Timestamp:
01/05/17 04:10:03 (10 months ago)
Author:
rmccue
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.
Fixes #39047.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r39323 r39684  
    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.