Make WordPress Core

Opened 4 years ago

#39678 new defect (bug)

get_term_by slug with "0" as value

Reported by: fausonealessio Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: Taxonomy Keywords:
Focuses: Cc:


Executing this code


my expectations were to obtain a taxonomy term, considering that one actually exists in my database, but instead the function returned false due to the PHP empty function returning true (see https://core.trac.wordpress.org/browser/tags/4.7/src/wp-includes/taxonomy.php#L844).
The empty function behaves according to documentation (http://php.net/manual/en/function.empty.php) but the string "0" should be accepted to be searched if it is possible to use it to create a taxonomy term.

Change History (0)

Note: See TracTickets for help on using tickets.