[wp-trac] [WordPress Trac] #58411: When Object Cache Pro plugin is enabled

WordPress Trac noreply at wordpress.org
Fri May 26 07:15:24 UTC 2023


#58411: When Object Cache Pro plugin is enabled
--------------------------+------------------------------
 Reporter:  danidorad0    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Cache API     |     Version:  6.2.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by sabernhardt):

 * keywords:  reporter-feedback =>
 * component:  Taxonomy => Cache API


Old description:

> 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
> /export/www/wordpress/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)

New description:

 {{{
 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)
 }}}

--

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


More information about the wp-trac mailing list