[wp-trac] [WordPress Trac] #61406: Heading block attribute type issue

WordPress Trac noreply at wordpress.org
Wed Sep 17 08:54:25 UTC 2025


#61406: Heading block attribute type issue
-------------------------------+------------------------------
 Reporter:  metaphorcreations  |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  6.5.4
 Severity:  normal             |  Resolution:
 Keywords:  needs-test-info    |     Focuses:
-------------------------------+------------------------------

Comment (by andfinally):

 We are getting this issue in unit tests for RSS feeds. I believe this
 problem appeared after the WordPress 6.8.1 update.

 When we include the markup of an image block in a test post, example
 below, the test fails, and we get the notice:


 {{{
 Notice: Function rest_validate_value_from_schema was called
 <strong>incorrectly</strong>. The "type" schema keyword for caption can
 only be one of the built-in types: array, object, string, number, integer,
 boolean, and null. Please see <a href="https://developer.wordpress.org
 /advanced-administration/debug/debug-wordpress/">Debugging in
 WordPress</a> for more information. (This message was added in version
 5.5.0.) in /tmp/wordpress/wp-includes/functions.php on line 6114
 }}}

 {{{
 <!-- wp:image {"url":"http://example.org/wp-
 content/uploads/2022/03/55038451-0-image-a-2_1646636766274.jpg?quality=90\u0026strip=all","caption":"Lorem
 ipsum","id":10853156,"sizeSlug":"full","linkDestination":"none"} -->
 }}}

 It looks like the following call stack is being run:

 {{{
 \do_blocks
 -> \render_block
 -> \WP_Block::render
 -> \WP_Block::__get
 -> \WP_Block_Type::prepare_attributes_for_render
 -> \rest_validate_value_from_schema
 }}}

 When `rest_validate_value_from_schema` gets to the caption, the parameters
 are:

 {{{
 Value: Lorem ipsum
 Schema: Array
 (
     [type] => rich-text
     [source] => rich-text
     [selector] => figcaption
     [role] => content
 )
 }}}

 This is validating the post content against the data types defined in the
 `block.json` file for the `core/image` block. There, `rich-text` is an
 acceptable type. But `rest_validate_value_from_schema` expects `string`,
 and complains.

 To me, this doesn't look like a Gutenberg bug but an issue in the PHP.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61406#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list