From bad04a8ca198372428c701ea8c810e14807429b9 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 20 Nov 2024 13:51:21 +0000 Subject: [PATCH] Options, Meta APIs: Ensure duplicate salts are properly flagged. 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]. Reviewed by davidbaumwald. Merges [59427] to the 6.7 branch. Props juliobox, ankitkumarshah, dilipbheda, johnbillion, joemcgill, desrosj. Fixes #62424. git-svn-id: https://develop.svn.wordpress.org/branches/6.7@59434 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/pluggable.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index da637ebbcf..cc16e8c8bd 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -2479,16 +2479,7 @@ if ( ! function_exists( 'wp_salt' ) ) : 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//branches//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 ) { @@ -2499,6 +2490,15 @@ if ( ! function_exists( 'wp_salt' ) ) : $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//branches//dist/wp-config-sample.php + */ + $duplicated_keys[ __( 'put your unique phrase here' ) ] = true; } /*