Make WordPress Core

Changeset 30168


Ignore:
Timestamp:
11/01/2014 10:53:35 PM (10 years ago)
Author:
wonderboymusic
Message:

In wp_ajax_get_tagcloud(), bail immediately if $_POST['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

    r30167 r30168  
    820820 */
    821821function wp_ajax_get_tagcloud() {
    822     if ( isset( $_POST['tax'] ) ) {
    823         $taxonomy = sanitize_key( $_POST['tax'] );
    824         $tax = get_taxonomy( $taxonomy );
    825         if ( ! $tax )
    826             wp_die( 0 );
    827         if ( ! current_user_can( $tax->cap->assign_terms ) )
    828             wp_die( -1 );
    829     } else {
     822    if ( ! isset( $_POST['tax'] ) ) {
    830823        wp_die( 0 );
     824    }
     825
     826    $taxonomy = sanitize_key( $_POST['tax'] );
     827    $tax = get_taxonomy( $taxonomy );
     828    if ( ! $tax ) {
     829        wp_die( 0 );
     830    }
     831   
     832    if ( ! current_user_can( $tax->cap->assign_terms ) ) {
     833        wp_die( -1 );
    831834    }
    832835
Note: See TracChangeset for help on using the changeset viewer.