#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 |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.6 |
| Component: | Editor | Version: | 5.5 |
| Severity: | minor | Keywords: | commit |
| Cc: | Focuses: | rest-api |
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
@
6 years ago
- Focuses rest-api added
- Keywords commit added
This looks great to me, thanks for the patch @bobbingwide!
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
TRAC 51231 - pass $attribute_name to rest_validate_value_from_schema. Correct typo for verbatim