Skip to content

Incorrect message shuffling salt in PHP 5.6 #175

@ernilambar

Description

@ernilambar

Bug Report

Describe the current, buggy behavior

  • PHP 5.6 (where random_int() is not available)

wp config shuffle-salts WP_CACHE_KEY_SALT NONCE_SALT

Output:

Warning: Could not shuffle the unknown key 'WP_CACHE_KEY_SALT'.
Warning: Could not shuffle the unknown key 'WP_CACHE_KEY_SALT'.
Success: Shuffled the salt keys.

Here NONCE_SALT is actually shuffled. Warning of WP_CACHE_KEY_SALT appears two times.

Another example:

wp config shuffle-salts NEW_KEY1 NONCE_SALT NONCE_KEY NEW_KEY2

Output:

Warning: Could not shuffle the unknown key 'NEW_KEY1'.
Warning: Could not shuffle the unknown key 'NEW_KEY1'.
Warning: Could not shuffle the unknown key 'NEW_KEY2'.
Success: Shuffled the salt keys.

Describe what you would expect as the correct outcome

Warning message should appear only once per key.

Let us know what environment you are running this on

OS:     Darwin Nilambars-MacBook-Pro.local 22.6.0 Darwin Kernel Version 22.6.0: Tue Nov  7 21:48:06 PST 2023; root:xnu-8796.141.3.702.9~2/RELEASE_X86_64 x86_64
Shell:  /bin/zsh
PHP binary:     /usr/local/Cellar/php@5.6/5.6.40_9/bin/php
PHP version:    5.6.40
php.ini used:   /usr/local/etc/php/5.6/php.ini
MySQL binary:   /usr/local/bin/mysql
MySQL version:  mysql  Ver 8.3.0 for macos13.6 on x86_64 (Homebrew)
SQL modes:
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /Users/nilambarsharma/Temp/phptest
WP-CLI packages dir:
WP-CLI cache dir:       /Users/nilambarsharma/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.10.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions