Make WordPress Core

Changeset 16377


Ignore:
Timestamp:
11/15/2010 06:38:10 AM (16 years ago)
Author:
nacin
Message:

Properly check, initialize, or cast a number of variables. props ChenHui. see #14642.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r16175 r16377  
    1414
    1515// Back-compat for viewing comments of an entry
    16 if ( $_redirect = intval( max( @$_REQUEST['p'], @$_REQUEST['attachment_id'], @$_REQUEST['page_id'] ) ) ) {
    17         wp_redirect( admin_url('edit-comments.php?p=' . $_redirect ) );
    18         exit;
    19 } else {
    20         unset( $_redirect );
    21 }
     16foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) {
     17        if ( ! empty( $_REQUEST[ $_redirect ] ) ) {
     18                wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) );
     19                exit;
     20        }
     21}
     22unset( $_redirect );
    2223
    2324// Handle bulk actions
  • trunk/wp-admin/includes/image-edit.php

    r16130 r16377  
    423423        $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
    424424        $restored = false;
    425         $msg = '';
     425        $msg = new stdClass;
    426426
    427427        if ( !is_array($backup_sizes) ) {
     
    494494
    495495function wp_save_image($post_id) {
    496         $return = '';
     496        $return = new stdClass;
    497497        $success = $delete = $scaled = $nocrop = false;
    498498        $post = get_post($post_id);
  • trunk/wp-admin/includes/user.php

    r15896 r16377  
    5656function edit_user( $user_id = 0 ) {
    5757        global $wp_roles, $wpdb;
    58         if ( $user_id != 0 ) {
     58        $user = new WP_User( $user_id );
     59        if ( $user_id ) {
    5960                $update = true;
    6061                $user->ID = (int) $user_id;
     
    6364        } else {
    6465                $update = false;
    65                 $user = '';
    6666        }
    6767
  • trunk/wp-includes/functions.php

    r16365 r16377  
    42334233                        $extra_headers[$key] = $key;
    42344234                }
    4235                 $all_headers = array_merge($extra_headers, $default_headers);
     4235                $all_headers = array_merge( $extra_headers, (array) $default_headers );
    42364236        } else {
    42374237                $all_headers = $default_headers;
Note: See TracChangeset for help on using the changeset viewer.