[wp-trac] [WordPress Trac] #37400: Filter in wp_object_type_exists allows for fatal error

WordPress Trac noreply at wordpress.org
Mon Jul 18 20:01:11 UTC 2016


#37400: Filter in wp_object_type_exists allows for fatal error
--------------------------------+-------------------------
 Reporter:  chriscct7           |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  high                |  Milestone:  4.6
Component:  Options, Meta APIs  |    Version:
 Severity:  normal              |   Keywords:  needs-patch
  Focuses:                      |
--------------------------------+-------------------------
 In the wp_object_type_exists filter, if a person removes all of the object
 types, and returns and empty string or false, a fatal error will occur at
 the if statement, as it does not check to see if the data contained in the
 variable is empty or an array first.


 {{{
 function wp_object_type_exists( $object_type ) {
         /**
          * Filters WordPress object types.
          *
          * @since 4.6.0
          *
          * @param array  $types Array of object types.
          */
         $types = apply_filters( 'wp_object_types', array( 'post',
 'comment', 'user', 'term' ) );
         if ( in_array( $object_type, $types ) ) {
                 return true;
         }
         return false;
 }
 }}}

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


More information about the wp-trac mailing list