Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#21593 closed defect (bug) (fixed)

register_taxonomy() doesn't fail when taxonomy name too long

Reported by: psbook's profile psbook Owned by: ryan's profile ryan
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.4.1
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description (last modified by nacin)

The 'taxonomy' field of the 'term_taxonomy' table is VARCHAR(32), ie truncated at 32 characters. But register_taxonomy() doesn't fail when you try to create a taxonomy with a unique name longer than this.

The effects are that terms can be added to 'terms' table along with corresponding entries in 'term_taxonomy', but that these can't be read back again. The taxonomy appears in the admin menus, but appears to be totally empty.

Attachments (1)

21593.patch (1.6 KB) - added by ocean90 12 years ago.

Download all attachments as: .zip

Change History (8)

#1 @nacin
12 years ago

  • Description modified (diff)
  • Summary changed from create_taxonomy() doesn't fail when taxonomy name too long to register_taxonomy() doesn't fail when taxonomy name too long

In register_post_type(), we do:

if ( strlen( $post_type ) > 20 )
		return new WP_Error( 'post_type_too_long', __( 'Post types cannot exceed 20 characters in length' ) );

Seems like a good thing here.

12 years ago

#2 @ocean90
12 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.5

#3 @ocean90
12 years ago

Related: #21600

#4 @ryan
12 years ago

We need to make sure sanitize_key() doesn't trip over 'attachment:' taxonomy strings, otherwise looks good.

#5 @ryan
12 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [22307]:

Return WP_Error when registering a taxonomy that exceeds 32 characters.

Props ocean90.
fixes #21593

#7 @duck_
12 years ago

In [22309]:

Fix documentation typo: s/WP_Erorr/WP_Error/. See #21593.

Note: See TracTickets for help on using tickets.