Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions features/config-shuffle-salts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,17 @@ Feature: Refresh the salts in the wp-config.php file
"""
define( 'NEW_KEY'
"""

@less-than-php-7.0
Scenario: Shuffling salts duplicate warnings on PHP < 7.0
Given a WP install
When I try `wp config shuffle-salts WP_CACHE_KEY_SALT NONCE_SALT`
Then STDERR should contain:
"""
Warning: Could not shuffle the unknown key 'WP_CACHE_KEY_SALT'.
"""
And STDERR should not contain:
"""
Warning: Could not shuffle the unknown key 'WP_CACHE_KEY_SALT'.
Warning: Could not shuffle the unknown key 'WP_CACHE_KEY_SALT'.
"""
3 changes: 2 additions & 1 deletion src/Config_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -889,11 +889,12 @@ public function shuffle_salts( $args, $assoc_args ) {

try {
foreach ( $keys as $key ) {
$unique_key = self::unique_key();
if ( ! $force && ! in_array( $key, self::DEFAULT_SALT_CONSTANTS, true ) ) {
WP_CLI::warning( "Could not shuffle the unknown key '{$key}'." );
continue;
}
$secret_keys[ $key ] = trim( self::unique_key() );
$secret_keys[ $key ] = trim( $unique_key );
}
} catch ( Exception $ex ) {
foreach ( $keys as $key ) {
Expand Down