[wp-trac] [WordPress Trac] #51370: Errors in the wp_dropdown_users() function when specifying a non-existent user
    WordPress Trac 
    noreply at wordpress.org
       
    Mon Sep 21 21:42:50 UTC 2020
    
    
  
#51370: Errors in the wp_dropdown_users() function when specifying a non-existent
user
-------------------------------+-----------------------------
 Reporter:  campusboy1987      |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  5.5.1
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 Hello!
 When editing a page whose author was deleted in the classic editor, the
 metabox with the author's choice generates a "Notice"error.
 When the Metabox is called by the post_author_meta_box () function, the
 wp_dropdown_users () function is run, where one of the parameters is:
 {{{
 'selected' => empty( $post->ID ) ? $user_ID : $post->post_author,
 }}}
 This causes the following section of code to run:
 {{{
 $users[] = get_userdata( $parsed_args['selected'] );
 }}}
 But since the page author is deleted, **get_userdata()** returns **false**
 and the data will still be added to the list of users, which generates an
 error when composing user data, since the code expects an object of the
 **WP_User** class.
 Example of an error in the log file:
 {{{
 Trying to get property 'display_name' of non-object in ..\wp-
 includes\user.php on line 1208
 Trying to get property 'user_login' of non-object in ..\wp-
 includes\user.php on line 1208
 Trying to get property 'ID' of non-object in ..\wp-includes\user.php on
 line 1215
 Trying to get property 'ID' of non-object in ..\wp-includes\user.php on
 line 1216
 }}}
-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51370>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
    
    
More information about the wp-trac
mailing list