[wp-trac] [WordPress Trac] #55777: Undefined index: type in /wp-includes/rest-api.php

WordPress Trac noreply at wordpress.org
Mon May 23 08:59:24 UTC 2022


#55777: Undefined index: type in /wp-includes/rest-api.php
-------------------------------+------------------------------
 Reporter:  Mte90              |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  REST API           |     Version:  5.9.3
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  rest-api
-------------------------------+------------------------------

Comment (by Mte90):

 I don't have in my website a REST with that value, my guess is that is
 generated by Woocommerce (it is used).

 Looking at the code https://github.com/WordPress/wordpress-
 develop/blob/trunk/src/wp-includes/rest-api.php#L2098:

 {{{#!php
 <?php
 if ( ! isset( $args['type'] ) ) {
                 /* translators: %s: Parameter. */
                 _doing_it_wrong( __FUNCTION__, sprintf( __( 'The "type"
 schema keyword for %s is required.' ), $param ), '5.5.0' );
         }

         if ( is_array( $args['type'] ) ) {
 }}}

 We check if isset later if it is an array but not together so there is the
 error.

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


More information about the wp-trac mailing list