[wp-trac] [WordPress Trac] #51231: prepare_attributes_for_render should pass $attribute_name to rest_validate_value_from_schema
WordPress Trac
noreply at wordpress.org
Thu Sep 3 13:12:52 UTC 2020
#51231: prepare_attributes_for_render should pass $attribute_name to
rest_validate_value_from_schema
--------------------------+-----------------------------
Reporter: bobbingwide | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 5.5
Severity: minor | Keywords:
Focuses: |
--------------------------+-----------------------------
I accidentally discovered an error in my code where the attribute type for
a server side rendered block was set to 'string ' - with an unexpected
trailing space before the closing quote.
The doing_it_wrong message didn't tell me the name of the attribute that
was in error.
{{{
Notice: rest_validate_value_from_schema was called incorrectly.
The "type" schema keyword for can only be one of the built-in types:
array, object, string, number, integer, boolean and null.
Please see Debugging in WordPress for more information.
(This message was added in version 5.5.0.)
in C:\apache\htdocs\oikcom\wp-includes\functions.php on line 5225
}}}
Had it said:
{{{
The "type" schema keyword for until can only be one of the built-in types:
}}}
then I might have found the problem a bit quicker.
The fix would be to `change prepare_attributes_for_render` to pass the
`$attribute_name` as the third parameter to
`rest_validate_value_from_schema`.
{{{
$is_valid = rest_validate_value_from_schema( $value, $schema ,
$attribute_name );
}}}
Also correct the spelling of `vebatim` - to `verbatim`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51231>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list