mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
REST API: Don't assume all item schemas have properties.
All schema types, not just objects, are permitted as the base type of a resource. A future patch could add validation support for those types, but this fix only prevents a PHP warning from being issued. Props dhavalkasvala, johnwatkins0, birgire. Fixes #48785. git-svn-id: https://develop.svn.wordpress.org/trunk@47328 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -344,8 +344,10 @@ abstract class WP_REST_Controller {
|
||||
|
||||
$schema = $this->get_item_schema();
|
||||
|
||||
foreach ( $schema['properties'] as &$property ) {
|
||||
unset( $property['arg_options'] );
|
||||
if ( ! empty( $schema['properties'] ) ) {
|
||||
foreach ( $schema['properties'] as &$property ) {
|
||||
unset( $property['arg_options'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $schema;
|
||||
|
||||
Reference in New Issue
Block a user