From a786fb779c7ff0a52bc1a9452fef4fd1d3ee9fea Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 1 Nov 2014 22:48:22 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@30167 git-svn-id: http://core.svn.wordpress.org/trunk@30167 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 21 ++++++++++++--------- wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index eea72944fc..071514453d 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -103,17 +103,20 @@ function wp_ajax_fetch_list() { * @since 3.1.0 */ function wp_ajax_ajax_tag_search() { - if ( isset( $_GET['tax'] ) ) { - $taxonomy = sanitize_key( $_GET['tax'] ); - $tax = get_taxonomy( $taxonomy ); - if ( ! $tax ) - wp_die( 0 ); - if ( ! current_user_can( $tax->cap->assign_terms ) ) - wp_die( -1 ); - } else { + if ( ! isset( $_GET['tax'] ) ) { wp_die( 0 ); } + $taxonomy = sanitize_key( $_GET['tax'] ); + $tax = get_taxonomy( $taxonomy ); + if ( ! $tax ) { + wp_die( 0 ); + } + + if ( ! current_user_can( $tax->cap->assign_terms ) ) { + wp_die( -1 ); + } + $s = wp_unslash( $_GET['q'] ); $comma = _x( ',', 'tag delimiter' ); @@ -1142,7 +1145,7 @@ function wp_ajax_add_meta() { wp_die( -1 ); if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) ) wp_die( 1 ); - + // If the post is an autodraft, save the post as a draft and then // attempt to save the meta. if ( $post->post_status == 'auto-draft' ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 080a6cf4ff..df17fe8fcd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.1-alpha-30166'; +$wp_version = '4.1-alpha-30167'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.