From 0df685da44141f22c82963b8803811bab5ba5801 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 9 Jul 2013 20:31:04 +0000 Subject: [PATCH] In general template functions, cast to string then ensure we actually have a template name before proceeding. Affects get_sidebar(), get_header(), get_footer(), get_template_part(). props tivnet for initial patch. fixes #24714. git-svn-id: https://develop.svn.wordpress.org/trunk@24616 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/general-template.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 7d7a4a90d9..23499d7c07 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -25,7 +25,8 @@ function get_header( $name = null ) { do_action( 'get_header', $name ); $templates = array(); - if ( isset($name) ) + $name = (string) $name; + if ( '' !== $name ) $templates[] = "header-{$name}.php"; $templates[] = 'header.php'; @@ -54,7 +55,8 @@ function get_footer( $name = null ) { do_action( 'get_footer', $name ); $templates = array(); - if ( isset($name) ) + $name = (string) $name; + if ( null !== $name && false !== $name ) $templates[] = "footer-{$name}.php"; $templates[] = 'footer.php'; @@ -83,7 +85,8 @@ function get_sidebar( $name = null ) { do_action( 'get_sidebar', $name ); $templates = array(); - if ( isset($name) ) + $name = (string) $name; + if ( '' !== $name ) $templates[] = "sidebar-{$name}.php"; $templates[] = 'sidebar.php'; @@ -120,7 +123,8 @@ function get_template_part( $slug, $name = null ) { do_action( "get_template_part_{$slug}", $slug, $name ); $templates = array(); - if ( isset($name) ) + $name = (string) $name; + if ( '' !== $name ) $templates[] = "{$slug}-{$name}.php"; $templates[] = "{$slug}.php";