[wp-trac] [WordPress Trac] #63427: User roles property should always be an array, but they sometimes become an object in localized data
WordPress Trac
noreply at wordpress.org
Thu Jun 12 19:36:15 UTC 2025
#63427: User roles property should always be an array, but they sometimes become an
object in localized data
-------------------------------------------------+-------------------------
Reporter: haruncpi | Owner:
| SergeyBiryukov
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 6.9
Component: Users | Version: 2.0
Severity: normal | Resolution:
Keywords: has-patch has-test-info has-unit- | Focuses:
tests changes-requested reporter-feedback |
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* keywords: has-patch has-test-info has-unit-tests changes-requested =>
has-patch has-test-info has-unit-tests changes-requested reporter-
feedback
* version: 6.8 => 2.0
Comment:
I've been able to track the introduction of `array_keys` back to 1.6
[2793], which is not the problem itself, but is the main reason of why
this is happening. Because this thing has probably existed historically,
from the inception of this function.
The question here is: @haruncpi why you don't simply preprocess the
resulting json into an array, before delivering it to
`wp_localize_script`?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63427#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list