Coding Standards: Extract `extract()` from the codebase.
Of the last four instances of `extract()` occurring, three of them are removed by this commit, and the fourth is appropriately documented. See #45934. Built from https://develop.svn.wordpress.org/trunk@44569 git-svn-id: http://core.svn.wordpress.org/trunk@44400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2785313bf2
commit
08e8270a48
|
@ -68,7 +68,6 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
extract( $args, EXTR_SKIP );
|
|
||||||
|
|
||||||
/** This filter is documented in wp-includes/default-widgets.php */
|
/** This filter is documented in wp-includes/default-widgets.php */
|
||||||
$args['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Ephemera', 'twentyeleven' ) : $instance['title'], $instance, $this->id_base );
|
$args['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Ephemera', 'twentyeleven' ) : $instance['title'], $instance, $this->id_base );
|
||||||
|
|
|
@ -684,6 +684,15 @@ function load_template( $_template_file, $require_once = true ) {
|
||||||
global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
|
global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
|
||||||
|
|
||||||
if ( is_array( $wp_query->query_vars ) ) {
|
if ( is_array( $wp_query->query_vars ) ) {
|
||||||
|
/*
|
||||||
|
* This use of extract() cannot be removed. There are many possible ways that
|
||||||
|
* templates could depend on variables that it creates existing, and no way to
|
||||||
|
* detect and deprecate it.
|
||||||
|
*
|
||||||
|
* Passing the EXTR_SKIP flag is the safest option, ensuring globals and
|
||||||
|
* function variables cannot be overwritten.
|
||||||
|
*/
|
||||||
|
// phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
||||||
extract( $wp_query->query_vars, EXTR_SKIP );
|
extract( $wp_query->query_vars, EXTR_SKIP );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.1-beta1-44568';
|
$wp_version = '5.1-beta1-44569';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue