Make WordPress Core


Ignore:
Timestamp:
11/01/2014 10:47:27 PM (12 years ago)
Author:
wonderboymusic
Message:

In wp_ajax_ajax_tag_search(), bail immediately if $_GET['tax'] isn't set so that all of the variable setting can happen in the same nest scope as the rest of the function - wp_die() confuses Scrutinizer.

See #30224.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r30155 r30167  
    104104 */
    105105function wp_ajax_ajax_tag_search() {
    106         if ( isset( $_GET['tax'] ) ) {
    107                 $taxonomy = sanitize_key( $_GET['tax'] );
    108                 $tax = get_taxonomy( $taxonomy );
    109                 if ( ! $tax )
    110                         wp_die( 0 );
    111                 if ( ! current_user_can( $tax->cap->assign_terms ) )
    112                         wp_die( -1 );
    113         } else {
     106        if ( ! isset( $_GET['tax'] ) ) {
    114107                wp_die( 0 );
     108        }
     109
     110        $taxonomy = sanitize_key( $_GET['tax'] );
     111        $tax = get_taxonomy( $taxonomy );
     112        if ( ! $tax ) {
     113                wp_die( 0 );
     114        }
     115
     116        if ( ! current_user_can( $tax->cap->assign_terms ) ) {
     117                wp_die( -1 );
    115118        }
    116119
     
    11431146                if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) )
    11441147                        wp_die( 1 );
    1145                
     1148
    11461149                // If the post is an autodraft, save the post as a draft and then
    11471150                // attempt to save the meta.
Note: See TracChangeset for help on using the changeset viewer.