From 12069068bd9531663cafce7e63081cb388ba29ad Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 28 Feb 2023 13:20:04 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@55433 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/pluggable.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index db8b55acbf..696f1e74bd 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -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//branches//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//branches//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}" ) ) {