Download & Extend

Bug in taxonomy_get_term_by_name()

Project:Drupal core
Version:6.16
Component:taxonomy.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I am trying to embed PHP code into a Views Header that shows the Description of a vocabulary term.

I noticed there's a difference in the returned array between when I use taxonomy_get_term_by_name() and when I use taxonomy_get_term().

When I use taxonomy_get_term() (passing it the term id number), I get this in return:

stdClass Object ( [tid] => 22 [vid] => 1 [name] => Basic [description] => UW Information Technology services available to UW faculty, staff, and students. [weight] => 0 ) Enhanced technology services available from UW Information Technology.

When I use taxonomy_get_term_by_name(), passing a term name, I get this:

Array ( [0] => stdClass Object ( [tid] => 23 [vid] => 1 [name] => Self-Sustaining [description] => Enhanced technology services available from UW Information Technology. [weight] => 0 ) )

in other words, using taxonomy_get_term_by_name() embeds the returned term object into element [0] of a multidimensional array, where using taxonomy_get_term() just returns the term object as its own array.

Seems like a bug to me.

nobody click here