Skip to content

Commit

Permalink
Users: Adjust the initialization of the $duplicated_keys array in `…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
SergeyBiryukov committed Feb 28, 2023
1 parent 933bb39 commit 0449c23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions wp-includes/pluggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2417,14 +2417,16 @@ 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
*/
__( '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}" ) ) {
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0449c23

Please sign in to comment.