Users: Adjust the initialization of the `$duplicated_keys` array in `wp_salt()`.

This avoids an endless loop if `get_current_user_id()` is used in a callback attached to the `gettext` filter.

With the translated phrase moved into a separate assignment, the function succeeds in setting the static `$duplicated_keys` array once and no longer goes into this code section on subsequent calls.

Follow-up to [54249].

Props adityaarora010196, SergeyBiryukov.
Fixes #57121.
Built from https://develop.svn.wordpress.org/trunk@55433


git-svn-id: http://core.svn.wordpress.org/trunk@54966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-02-28 13:22:22 +00:00
parent 933bb3999b
commit 0449c238bd
2 changed files with 10 additions and 8 deletions

View File

@ -2417,14 +2417,16 @@ 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/<locale code>/branches/<wp version>/dist/wp-config-sample.php
*/
__( 'put your unique phrase here' ) => true,
'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;
foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) {
foreach ( array( 'KEY', 'SALT' ) as $second ) {
if ( ! defined( "{$first}_{$second}" ) ) {

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-beta3-55432';
$wp_version = '6.2-beta3-55433';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.