Files
wordpress/wp-includes
Sergey Biryukov 3d3ecd8796 Users: Initialize the WP_User::$roles property as a sequential array.
Previously, if any roles were filtered out via `array_filter()` when assigning the `WP_User::$roles` property in `WP_User::get_role_caps()`, the resulting array could contain non-sequential numeric keys, which would then cause it to be treated as an object when JSON-encoded, e.g. in `wp_localize_script()`, instead of a proper array, breaking client-side expectations.

This commit ensures that the `WP_User::$roles` property is always treated as an array.

Follow-up to [2703], [2793], [22118].

Props haruncpi, peterwilsoncc, SirLouen, getsyash, wildworks, johnjamesjacoby, SergeyBiryukov.
Fixes #63427.
Built from https://develop.svn.wordpress.org/trunk@61210


git-svn-id: http://core.svn.wordpress.org/trunk@60546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-11 12:53:32 +00:00
..
2025-11-07 12:29:46 +00:00
2025-11-07 12:42:34 +00:00
2025-11-07 12:42:34 +00:00
2025-11-07 12:42:34 +00:00
2025-11-07 12:42:34 +00:00