[wp-trac] [WordPress Trac] #59841: Post 6.4 Upgrade Fatal:

WordPress Trac noreply at wordpress.org
Wed Nov 8 16:52:10 UTC 2023


#59841: Post 6.4 Upgrade Fatal:
--------------------------+-----------------------------
 Reporter:  rebasaurus    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 After upgrading to 6.4, this fatal occurs:

 {{{
 PHP message: Fatal error: Uncaught TypeError: Cannot access offset of type
 string on string in /var/www/wp-includes/rest-api.php:3082
 Stack trace:
 #0 /var/www/wp-includes/rest-api.php(3104):
 rest_default_additional_properties_to_false('string')
 #1 /var/www/wp-includes/rest-api/fields/class-wp-rest-meta-
 fields.php(484): rest_default_additional_properties_to_false(Array)
 #2 /var/www/wp-includes/rest-api/fields/class-wp-rest-meta-
 fields.php(511): WP_REST_Meta_Fields->get_registered_fields()
 #3 /var/www/wp-includes/rest-api/endpoints/class-wp-rest-revisions-
 controller.php(768): WP_REST_Meta_Fields->get_field_schema()
 #4 /var/www/wp-includes/rest-api/endpoints/class-wp-rest-
 controller.php(388): WP_REST_Revisions_Controller->get_item_schema()
 #5 /var/www/wp-includes/rest-api/endpoints/class-wp-rest-
 controller.php(343): WP_REST_Controller->get_context_param()
 #6 /var/www/wp-includes/rest-api/endpoints/class-wp-rest-revisions-
 controller.php(783): WP_REST_Controller->get_collection_params()
 #7 /var/www/wp-includes/rest-api/endpoints/class-wp-rest-revisions-
 controller.php(97): WP_REST_Revisions_Controller->get_collection_params()
 #8 /var/www/wp-includes/rest-api.php(250):
 WP_REST_Revisions_Controller->register_routes()
 #9 /var/www/wp-includes/class-wp-hook.php(324):
 create_initial_rest_routes(Object(WP_REST_Server))
 #10 /var/www/wp-includes/class-wp-hook.php(348):
 WP_Hook->apply_filters(NULL, Array)
 #11 /var/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
 #12 /var/www/wp-includes/rest-api.php(593): do_action('rest_api_init',
 Object(WP_REST_Server))
 #13 /var/www/wp-includes/rest-api.php(417): rest_get_server()
 #14 /var/www/wp-includes/class-wp-hook.php(324):
 rest_api_loaded(Object(WP))
 #15 /var/www/wp-includes/class-wp-hook.php(348):
 WP_Hook->apply_filters(NULL, Array)
 #16 /var/www/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
 #17 /var/www/wp-includes/class-wp.php(418):
 do_action_ref_array('parse_request', Array)
 #18 /var/www/wp-includes/class-wp.php(813): WP->parse_request('')
 #19 /var/www/wp-includes/functions.php(1336): WP->main('')
 #20 /var/www/wp-blog-header.php(16): wp()
 #21 /var/www/index.php(17): require('/var/www/wp-blo...')
 #22 {main}
   thrown in /var/www/wp-includes/rest-api.php on line 3082
 }}}


 I suspect introduced in https://core.trac.wordpress.org/changeset/56819.
 When `$schema` is of the below format and is passed into
 https://github.com/WordPress/WordPress/blob/436d55fa51a2f46ad6ac7e16fcb4e83618afb030
 /wp-includes/rest-api.php#L3081:

 {{{
 array (
   'type' => 'array',
   'items' => array (
     'type' => 'string',
   ),
 )
 }}}

 It recursively calls itself again at
 https://github.com/WordPress/WordPress/blob/436d55fa51a2f46ad6ac7e16fcb4e83618afb030
 /wp-includes/rest-api.php#L3104 with the 'items' array and throws the
 fatal. An example post type is `attachment` where I'm seeing it occur on.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59841>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list