diff --git a/wp-includes/abilities.php b/wp-includes/abilities.php index c71eeb158a..0320df3b9f 100644 --- a/wp-includes/abilities.php +++ b/wp-includes/abilities.php @@ -220,7 +220,6 @@ function wp_register_core_abilities(): void { 'db_server_info' => array( 'type' => 'string', 'description' => __( 'The database server vendor and version string reported by the driver.' ), - 'examples' => array( '8.0.34', '10.11.6-MariaDB' ), ), 'wp_version' => array( 'type' => 'string', diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php index 4f59d908de..6dfc540038 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php @@ -194,6 +194,27 @@ class WP_REST_Abilities_V1_List_Controller extends WP_REST_Controller { return current_user_can( 'read' ); } + /** + * Normalizes schema empty object defaults. + * + * Converts empty array defaults to objects when the schema type is 'object' + * to ensure proper JSON serialization as {} instead of []. + * + * @since 6.9.0 + * + * @param array $schema The schema array. + * @return array The normalized schema. + */ + private function normalize_schema_empty_object_defaults( array $schema ): array { + if ( isset( $schema['type'] ) && 'object' === $schema['type'] && isset( $schema['default'] ) ) { + $default = $schema['default']; + if ( is_array( $default ) && empty( $default ) ) { + $schema['default'] = (object) $default; + } + } + return $schema; + } + /** * Prepares an ability for response. * @@ -209,8 +230,8 @@ class WP_REST_Abilities_V1_List_Controller extends WP_REST_Controller { 'label' => $ability->get_label(), 'description' => $ability->get_description(), 'category' => $ability->get_category(), - 'input_schema' => $ability->get_input_schema(), - 'output_schema' => $ability->get_output_schema(), + 'input_schema' => $this->normalize_schema_empty_object_defaults( $ability->get_input_schema() ), + 'output_schema' => $this->normalize_schema_empty_object_defaults( $ability->get_output_schema() ), 'meta' => $ability->get_meta(), ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 81cb0efe57..dc697dad91 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '7.0-alpha-61243'; +$wp_version = '7.0-alpha-61244'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.