WordPress.org

Make WordPress Core

Changeset 23210


Ignore:
Timestamp:
12/27/12 15:36:08 (16 months ago)
Author:
nacin
Message:

Return WP_Error from wp_update_user() on a non-existent user, avoiding a fatal error in the process.

props n7studios, SergeyBiryukov.
fixes #22858 for trunk.
Unit tests: [11776/tests].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/user.php

    r22386 r23210  
    14531453    // First, get all of the original fields 
    14541454    $user_obj = get_userdata( $ID ); 
     1455    if ( ! $user_obj ) 
     1456        return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); 
    14551457 
    14561458    $user = $user_obj->to_array(); 
Note: See TracChangeset for help on using the changeset viewer.