From bf5447f4350aa56b8da75475b30c6cd65b49e29a Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 26 Mar 2014 18:22:13 +0000 Subject: [PATCH] WP_Theme: Return false from the display() method when get() fails. Fixes a potential warning on the themes page when the active theme is deleted. fixes #26873. Built from https://develop.svn.wordpress.org/trunk@27745 git-svn-id: http://core.svn.wordpress.org/trunk@27582 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-theme.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index c806d46624..f8844d4625 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -535,7 +535,7 @@ final class WP_Theme implements ArrayAccess { * @since 3.4.0 * * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. - * @return string String on success, false on failure. + * @return string|bool String on success, false on failure. */ public function get( $header ) { if ( ! isset( $this->headers[ $header ] ) ) @@ -571,10 +571,13 @@ final class WP_Theme implements ArrayAccess { * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. * @param bool $markup Optional. Whether to mark up the header. Defaults to true. * @param bool $translate Optional. Whether to translate the header. Defaults to true. - * @return string Processed header, false on failure. + * @return string|bool Processed header, false on failure. */ public function display( $header, $markup = true, $translate = true ) { $value = $this->get( $header ); + if ( false === $value ) { + return false; + } if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) ) $translate = false;