Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#30700 closed defect (bug) (invalid)

get_terms throws PHP notice when fields is set to 'id=>name'

Reported by: webgeekconsulting Owned by:
Priority: normal Milestone:
Component: Taxonomy Version: 4.0.1
Severity: normal Keywords:
Cc: Focuses:

Description

The following code will raise a notice in PHP version 5.3.27

get_terms( 'category', array( 'fields' => 'id=>name' ) );

Notice: Undefined property: stdClass::$count in wp-includes/taxonomy.php on line 1590

It seems this is because the field "count" is not returned as part of the result set.

Change History (1)

#1 @boonebgorges
12 years ago

  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → closed

In 4.1, 'count' will be selected for all values of 'fields'. See [29845] #29859. So this problem should disappear.

Note: See TracTickets for help on using tickets.