[wp-trac] [WordPress Trac] #63730: get_blogs_of_user running on single install and crashes

WordPress Trac noreply at wordpress.org
Mon Jul 21 12:05:26 UTC 2025


#63730: get_blogs_of_user running on single install and crashes
--------------------------+-----------------------------
 Reporter:  Keffr3n       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.8.2
 Severity:  normal        |   Keywords:  needs-testing
  Focuses:                |
--------------------------+-----------------------------
 Query Monitor crashes on 6.8.2, but works on 6.7.1

 pinpointed to get_blogs_of_user()

 I get this messge: [⚠️ WARNING] Blog object has empty blog_id.
 Flsh install, no plugins active except query-monitor.

 {{{#!php
 <?php
 add_action('init', function() {
     if ( ! is_admin() || ! current_user_can('administrator') ) return;

     $user_id = get_current_user_id();

     error_log("[DEBUG] Testing get_blogs_of_user() for user_id $user_id");

     try {
         $blogs = get_blogs_of_user($user_id);

         // If we get this far, log the result
         error_log("[DEBUG] get_blogs_of_user() returned: " .
 print_r($blogs, true));

         // Extra: Check for empty meta key access
         foreach ( $blogs as $blog ) {
             if ( empty($blog->blog_id) ) {
                 error_log("[⚠️ WARNING] Blog object has empty blog_id: " .
 print_r($blog, true));
             }
         }
     } catch (Throwable $e) {
         error_log("[ERROR] Exception from get_blogs_of_user(): " .
 $e->getMessage());
     }
 });
 }}}

 Since your trace ends in a call to abs() → absint() → get_metadata_raw(),
 that means a non-numeric value is being passed to abs(), likely from
 malformed metadata.


 If one of those keys is non-numeric or weirdly cast, it triggers:


 absint( $meta_id ) → abs( $non_number ) → Fatal error
 So the error isn't from a specific meta key, but from calling
 get_metadata() with an empty key, which causes WordPress to do something
 unsafe under certain plugin/plugin-free conditions.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63730>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list