WordPress.org

Make WordPress Core

Ticket #13317: 13317-a-little-more-strictness.patch

File 13317-a-little-more-strictness.patch, 850 bytes (added by hakre, 5 years ago)
  • wordpress/wp-includes/pluggable.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-tests
     
    103103function get_userdata( $user_id ) { 
    104104        global $wpdb; 
    105105 
    106         $user_id = absint( $user_id ); 
     106        if ( ! is_scalar( $user_id ) ) 
     107                return false; 
     108                 
     109        $user_id = abs( (int) $user_id ); 
    107110        if ( ! $user_id ) 
    108111                return false; 
    109112 
     
    112115        if ( $user ) 
    113116                return $user; 
    114117 
    115         if ( ! $user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d LIMIT 1", $user_id ) ) ) 
     118        if ( ! $user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->users} WHERE ID = %d LIMIT 1", $user_id ) ) ) 
    116119                return false; 
    117120 
    118121        _fill_user( $user );