[wp-trac] [WordPress Trac] #42327: WP_Term_Query returns an empty array instead of 0

WordPress Trac noreply at wordpress.org
Tue Oct 24 22:24:59 UTC 2017


#42327: WP_Term_Query returns an empty array instead of 0
--------------------------+------------------------------
 Reporter:  xParham       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by xParham):

 I have attached a patch.

 This in particular for me, is causing a fatal error on the `edit-tags.php`
 screen, when a filter that I have on the main query for the terms list
 sets the `parent` parameter to one with no descendants.

 Having an array returned instead of 0 will make the
 `WP_List_Table::set_pagination_args()` to fail because the pagination args
 set in `WP_Terms_List_Table::prepare_items()` uses `wp_count_terms()`
 which returns an array instead of integer which is then passed as the
 `total_items` for the pagination args:

 `Fatal error: Unsupported operand types in /wp-admin/includes/class-wp-
 list-table.php on line 284`

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42327#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list