Make WordPress Core

Opened 14 months ago

Last modified 14 months ago

#58411 new defect (bug)

When Object Cache Pro plugin is enabled

Reported by: danidorad0's profile danidorad0 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.2.2
Component: Cache API Keywords:
Focuses: Cc:

Description (last modified by sabernhardt)

function update_term_cache( $terms, $taxonomy = '' ) {
    $data = array();
    foreach ( (array) $terms as $term ) {
        // Create a copy in case the array was passed by reference.
        $_term = clone $term;

        // Object ID should not be cached.
        unset( $_term->object_id );

        $data[ $term->term_id ] = $_term;
    wp_cache_add_multiple( $data, 'terms' );

PHP Warning:  Undefined property: stdClass::$term_id in /.../wp-includes/taxonomy.php on line 3801
[24-May-2023 11:53:21 UTC] objectcache.error: Cache key must be integer or non-empty string, empty string given (require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WC_PB_Install::define_updating_constant, WC_PB_Install::is_update_pending, WC_PB_Install::must_update, WC_PB_Install::is_new_install, get_term_by, get_terms, WP_Term_Query->query, WP_Term_Query->get_terms, _prime_term_caches, update_term_cache)

Change History (3)

#1 @sabernhardt
14 months ago

  • Component changed from Taxonomy to Cache API
  • Description modified (diff)
  • Keywords reporter-feedback removed

#2 @petitphp
14 months ago

Hi @danidorad0, thanks for the ticket and welcome to trac.

Did you had other warnings like the one in the description ?

This issue could be from one of the plugin, can you try to replicate the issue on a fresh WordPress install ?

Thank you.

#3 @danidorad0
14 months ago


No, i only have this warning in one particular site inside a multisite installation with around 50 sites

I recall this guy @tillkruess telling that was a bug and opening a ticket somewhere, but not sure where he did exactly. Maybe he can throw some light but i doubt he might have time for supporting this kind of things...

Unfortunately i cannot replicate, this site is part of a multisite installation and i have a hectic workload to take care of this at the moment, I'm afraid.

Before the last wp update i was able to wrap the problematic line on a conditional if to avoid the warning, but with every update file was override. After the last wp update, wrapping that line resulted in a 502, so i decided to open the ticket.

Thanks in advance to check on this

Note: See TracTickets for help on using tickets.