REST API: Ensure a sidebar's widgets property is a list.

When a widget is removed from a sidebar, if it was removed from the middle of the list, the widgets property would become an object with numeric keys.

The sidebars controller now forces the widgets property to be a list.

Props walbo.
Fixes #53612.


git-svn-id: https://develop.svn.wordpress.org/trunk@51377 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Timothy Jacobs
2021-07-07 19:34:33 +00:00
parent 8c413885bd
commit c283bf2bb6
2 changed files with 54 additions and 2 deletions
@@ -304,7 +304,7 @@ class WP_REST_Sidebars_Controller extends WP_REST_Controller {
}
);
$sidebar['widgets'] = $widgets;
$sidebar['widgets'] = array_values( $widgets );
}
$schema = $this->get_item_schema();