Skip to content

Commit

Permalink
Options, Meta APIs: Ensure duplicate salts are properly flagged.
Browse files Browse the repository at this point in the history
Improvements were made in 6.7 to ensure that salts stored in the database were primed more efficiently.

The logic added to accomplish this suffered from an edge case where array indexes were unexpectedly missing when `wp_salt()` was called recursively.

Follow up to [58837].

Props juliobox, ankitkumarshah, dilipbheda, johnbillion, joemcgill, desrosj.
Fixes #62424.

git-svn-id: https://develop.svn.wordpress.org/trunk@59427 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Nov 20, 2024
1 parent e1d1493 commit 9b62294
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/wp-includes/pluggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2479,16 +2479,7 @@ function wp_salt( $scheme = 'auth' ) {

static $duplicated_keys;
if ( null === $duplicated_keys ) {
$duplicated_keys = array(
'put your unique phrase here' => true,
);

/*
* translators: This string should only be translated if wp-config-sample.php is localized.
* You can check the localized release package or
* https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php
*/
$duplicated_keys[ __( 'put your unique phrase here' ) ] = true;
$duplicated_keys = array();

foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) {
foreach ( array( 'KEY', 'SALT' ) as $second ) {
Expand All @@ -2499,6 +2490,15 @@ function wp_salt( $scheme = 'auth' ) {
$duplicated_keys[ $value ] = isset( $duplicated_keys[ $value ] );
}
}

$duplicated_keys['put your unique phrase here'] = true;

/*
* translators: This string should only be translated if wp-config-sample.php is localized.
* You can check the localized release package or
* https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php
*/
$duplicated_keys[ __( 'put your unique phrase here' ) ] = true;
}

/*
Expand Down

0 comments on commit 9b62294

Please sign in to comment.