[wp-trac] [WordPress Trac] #62424: Warning in wp_salt() since 6.7

WordPress Trac noreply at wordpress.org
Tue Nov 19 19:16:27 UTC 2024


#62424: Warning in wp_salt() since 6.7
-------------------------------------------------+-------------------------
 Reporter:  juliobox                             |       Owner:  desrosj
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.7.1
Component:  Options, Meta APIs                   |     Version:  6.7
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-screenshots has-       |     Focuses:
  testing-info reporter-feedback                 |
-------------------------------------------------+-------------------------

Comment (by joemcgill):

 While reviewing this with @desrosj, my hunch was that this error condition
 was being triggered only if the salts are defined AFTER the first time
 that `wp_salt()` is called. In this scenario, the foreach loop that sets
 the `$duplicated_keys` values would not include the salts and all of the
 options will be primed, and then the second time `wp_salt()` is called,
 the constants would be defined but not in the `$duplicated_keys` array. To
 avoid such a scenario, we could add a check to make sure that the options
 only get primed once, which I put together [https://github.com/WordPress
 /wordpress-develop/pull/7842 a quick PR example] to demonstrate.

 However when testing this with the reproduction steps from the ticket,
 that scenario is not the cause of this bug, but instead it's due to
 another condition where this can happen, which this would not address.

 While creating the `$duplicated_keys` array, `gettext` is
 [https://github.com/WordPress/wordpress-
 develop/blob/a1fae25abd86be9518e04292364feea9a70af225/src/wp-
 includes/pluggable.php#L2491 called here] to translate the 'put your
 unique phrase here' key. By adding a call to `get_user_locale()` in the
 `gettext` filter, it causes `wp_salt()` to be recursively called from
 before it has completed running the first time, but after
 `$duplicated_keys` is no longer `null`, so the recursive call skips
 filling out the `$duplicate_keys` array. This always causes the options to
 be primed, even when they likely don't need to be. We should probably try
 to avoid this scenario as well if possible.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62424#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list