Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#32830 closed defect (bug) (wontfix)

get_taxonomy_labels() does not check for the existence of the labels property

Reported by: ipm-frommen Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: close reporter-feedback
Focuses: Cc:


Inside get_taxonomy_labels(), we currently just access the labels property of the given $tax object. In case the object does not have any labels, this generates a PHP Notice.

The attached patch includes a fix for this.

Attachments (1)

32830.patch (587 bytes) - added by ipm-frommen 6 years ago.

Download all attachments as: .zip

Change History (4)

6 years ago

#1 @boonebgorges
6 years ago

  • Keywords close reporter-feedback added

In what situation would a taxonomy object not have a labels property? In register_taxonomy(), it's enforced: https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-includes/taxonomy.php?marks=330,347,414#L323

#2 @ipm-frommen
6 years ago

@boonebgorges in a world where someone manipulates the according global. But it's okay, if you rather assume everything is alright. This turned out to be not the bug I was having anyway. ;)

#3 @boonebgorges
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

If someone's manipulating the global, then we're doing them a service by showing them a PHP notice - they'll know they've mucked something up. Thanks for the ticket.

Note: See TracTickets for help on using tickets.