#51231 closed defect (bug) (fixed)
prepare_attributes_for_render should pass $attribute_name to rest_validate_value_from_schema
Reported by: | bobbingwide | Owned by: | helen |
---|---|---|---|
Milestone: | 5.6 | Priority: | normal |
Severity: | minor | Version: | 5.5 |
Component: | Editor | Keywords: | commit |
Focuses: | rest-api | Cc: |
Description
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
.
Attachments (1)
Change History (7)
#1
@
4 years ago
- Focuses rest-api added
- Keywords commit added
This looks great to me, thanks for the patch @bobbingwide!
This ticket was mentioned in Slack in #core by helen. View the logs.
4 years ago
#4
@
4 years ago
- Owner set to helen
- Resolution set to fixed
- Status changed from new to closed
In 48969:
Note: See
TracTickets for help on using
tickets.
TRAC 51231 - pass $attribute_name to rest_validate_value_from_schema. Correct typo for verbatim