[buddypress-trac] [BuddyPress Trac] #9227: Fatal error due to bp_get_object_terms function

buddypress-trac noreply at wordpress.org
Wed Sep 4 03:19:44 UTC 2024


#9227: Fatal error due to bp_get_object_terms function
--------------------------+---------------------
 Reporter:  raviousprime  |       Owner:  (none)
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  15.0.0
Component:  Members       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+---------------------

Comment (by espellcaste):

 I recreated the same environment from @raviousprime locally and was able
 to replicate.

 I added a [https://github.com/buddypress/buddypress/pull/370 pull request]
 where we perform a few tasks:

 - We add a doing it wrong notice. So that we highlight to the site that
 the function is being used too early.
 - If the function is used too early, we add this ^ notice and return an
 empty `array`. Since there is no registered taxonomy yet, it is a safer
 option than returning another error.
 - We handle cases where `wp_get_object_terms` returns an empty value or a
 `WP_Error`.

 @raviousprime If you could test this, it'd be great. You should see a new
 PHP notice:

 > PHP Notice:  Function bp_get_object_terms was called
 <strong>incorrectly</strong>. The <code>bp_get_object_terms</code>
 function requires the <code>bp_register_taxonomies</code> hook to be fired
 before is used. Please see <a href="https://developer.wordpress.org
 /advanced-administration/debug/debug-wordpress/">Debugging in
 WordPress</a> for more information. (This message was added in version
 15.0.0.) in /var/www/bp-single/wp-includes/functions.php on line 6085

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/9227#comment:11>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list