[wp-meta] [Making WordPress.org] #2591: User Badges plugin should check for WP_Error in ::get_author_badge_info()

Making WordPress.org noreply at wordpress.org
Sat Mar 18 21:01:17 UTC 2017


#2591: User Badges plugin should check for WP_Error in ::get_author_badge_info()
----------------------------+------------------------------
 Reporter:  SergeyBiryukov  |      Owner:
     Type:  defect          |     Status:  new
 Priority:  normal          |  Milestone:
Component:  Support Forums  |   Keywords:  has-patch commit
----------------------------+------------------------------
 [https://developer.wordpress.org/reference/functions/wp_get_post_terms/
 wp_get_post_terms()] can return an empty array if no terms were found, or
 a `WP_Error` object if the taxonomy does not exist.

 `User_Badges\Plugin::get_author_badge_info()` has a check for the former,
 but not for the latter. Normally, this code only runs when the taxonomy
 exists, but it can still lead to a fatal error if
 `WPORG_SUPPORT_FORUMS_BLOGID` is not defined (e.g. to differentiate
 between English and Rosetta forums on a local install):
 {{{
 Fatal error: Uncaught Error: Cannot use object of type WP_Error as array
 in wp-content/plugins/wporg-bbp-user-badges/inc/class-plugin.php:142
 }}}

--
Ticket URL: <https://meta.trac.wordpress.org/ticket/2591>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list