From 80a37d2fcd2756464b345815eb2649145058185e Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 15 May 2014 05:41:14 +0000 Subject: [PATCH] Eliminate the use of `extract()` in `WP_Tax_Query::get_sql()`. All unit tests still pass. See #22400. Built from https://develop.svn.wordpress.org/trunk@28422 git-svn-id: http://core.svn.wordpress.org/trunk@28249 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 42bff05e36..48d49e1866 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -738,17 +738,20 @@ class WP_Tax_Query { foreach ( $this->queries as $index => $query ) { $this->clean_query( $query ); - if ( is_wp_error( $query ) ) + if ( is_wp_error( $query ) ) { return self::$no_results; + } - extract( $query ); + $terms = $query['terms']; + $operator = $query['operator']; if ( 'IN' == $operator ) { if ( empty( $terms ) ) { if ( 'OR' == $this->relation ) { - if ( ( $index + 1 === $count ) && empty( $where ) ) + if ( ( $index + 1 === $count ) && empty( $where ) ) { return self::$no_results; + } continue; } else { return self::$no_results; @@ -766,8 +769,9 @@ class WP_Tax_Query { $where[] = "$alias.term_taxonomy_id $operator ($terms)"; } elseif ( 'NOT IN' == $operator ) { - if ( empty( $terms ) ) + if ( empty( $terms ) ) { continue; + } $terms = implode( ',', $terms ); @@ -778,8 +782,9 @@ class WP_Tax_Query { )"; } elseif ( 'AND' == $operator ) { - if ( empty( $terms ) ) + if ( empty( $terms ) ) { continue; + } $num_terms = count( $terms ); @@ -796,11 +801,11 @@ class WP_Tax_Query { $i++; } - if ( ! empty( $where ) ) + if ( ! empty( $where ) ) { $where = ' AND ( ' . implode( " $this->relation ", $where ) . ' )'; - else + } else { $where = ''; - + } return compact( 'join', 'where' ); }