WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#37400 closed defect (bug) (invalid)

Filter in wp_object_type_exists allows for fatal error

Reported by: chriscct7 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: needs-patch
Focuses: Cc:

Description

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;
}

Change History (2)

#1 @ocean90
5 years ago

  • Priority changed from high to normal

The latest patch on #35658 will remove that function.

#2 @jeremyfelt
5 years ago

  • Milestone 4.6 deleted
  • Resolution set to invalid
  • Status changed from new to closed

wp_object_type_exists() no longer exists. :) See [38095]

Note: See TracTickets for help on using tickets.