From 2d1d80f4c550d3fbe3a16d6bea212c3a1a127d50 Mon Sep 17 00:00:00 2001 From: desrosj Date: Wed, 6 Feb 2019 18:37:51 +0000 Subject: [PATCH] Themes: Revert returning the value of `locate_template()` in functions that call it. Because the names of the `get_header()`, `get_footer()`, `get_sidebar()`, and `get_template_part()` functions indicate that a value is returned, some plugins and themes already have `echo get_template_part()` in their codebase. Adding a return value to these functions using the approach in [44678] will cause the two unintended side effects of unexpected content being sent to the browser, and accidental path disclosure. Reverts [44678]. Props davidbinda. See #40969. Built from https://develop.svn.wordpress.org/trunk@44725 git-svn-id: http://core.svn.wordpress.org/trunk@44556 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/general-template.php | 16 ++++------------ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index cd89f4124a..11d4b77ff4 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -16,10 +16,8 @@ * "special". * * @since 1.5.0 - * @since 5.1.0 Added the return value. * * @param string $name The name of the specialised header. - * @return string The template filename if one is located. */ function get_header( $name = null ) { /** @@ -40,7 +38,7 @@ function get_header( $name = null ) { $templates[] = 'header.php'; - return locate_template( $templates, true ); + locate_template( $templates, true ); } /** @@ -53,10 +51,8 @@ function get_header( $name = null ) { * "special". * * @since 1.5.0 - * @since 5.1.0 Added the return value. * * @param string $name The name of the specialised footer. - * @return string The template filename if one is located. */ function get_footer( $name = null ) { /** @@ -77,7 +73,7 @@ function get_footer( $name = null ) { $templates[] = 'footer.php'; - return locate_template( $templates, true ); + locate_template( $templates, true ); } /** @@ -90,10 +86,8 @@ function get_footer( $name = null ) { * "special". * * @since 1.5.0 - * @since 5.1.0 Added the return value. * * @param string $name The name of the specialised sidebar. - * @return string The template filename if one is located. */ function get_sidebar( $name = null ) { /** @@ -114,7 +108,7 @@ function get_sidebar( $name = null ) { $templates[] = 'sidebar.php'; - return locate_template( $templates, true ); + locate_template( $templates, true ); } /** @@ -134,11 +128,9 @@ function get_sidebar( $name = null ) { * "special". * * @since 3.0.0 - * @since 5.1.0 Added the return value. * * @param string $slug The slug name for the generic template. * @param string $name The name of the specialised template. - * @return string The template filename if one is located. */ function get_template_part( $slug, $name = null ) { /** @@ -162,7 +154,7 @@ function get_template_part( $slug, $name = null ) { $templates[] = "{$slug}.php"; - return locate_template( $templates, true, false ); + locate_template( $templates, true, false ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 4f8135a4ea..14bc1992ba 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-beta3-44724'; +$wp_version = '5.1-beta3-44725'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.