Don't use variable variables in `WP_Query::get_posts()`.

See #27881.

Built from https://develop.svn.wordpress.org/trunk@28737


git-svn-id: http://core.svn.wordpress.org/trunk@28551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-06-11 17:50:16 +00:00
parent 17b17d1c78
commit c1e7c2d1de
1 changed files with 15 additions and 5 deletions

View File

@ -3082,9 +3082,13 @@ class WP_Query {
*/
$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
foreach ( $pieces as $piece ) {
$$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : '';
}
$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
}
/**
@ -3201,8 +3205,14 @@ class WP_Query {
* @param WP_Query &$this The WP_Query instance (passed by reference).
*/
$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
foreach ( $pieces as $piece )
$$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : '';
$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
}
if ( ! empty($groupby) )