From 1ac10346ceaa018d2c3bbb7e0ad4d9290efa1d0a Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 26 Sep 2017 08:54:47 +0000 Subject: [PATCH] Themes: Report theme as broken that sets itself as its parent. Props davilera. Fixes #40820. Built from https://develop.svn.wordpress.org/trunk@41601 git-svn-id: http://core.svn.wordpress.org/trunk@41436 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-theme.php | 8 ++++++++ wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index 0da9b5ea11..f4c2e1b710 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -250,6 +250,14 @@ final class WP_Theme implements ArrayAccess { } } + if ( ! $this->template && $this->stylesheet === $this->headers['Template'] ) { + /* translators: %s: Template */ + $this->errors = new WP_Error( 'theme_child_invalid', sprintf( __( 'The theme defines itself as its parent theme. Please check the "%s" header.' ), 'Template' ) ); + $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet ) ); + + return; + } + // (If template is set from cache [and there are no errors], we know it's good.) if ( ! $this->template && ! ( $this->template = $this->headers['Template'] ) ) { $this->template = $this->stylesheet; diff --git a/wp-includes/version.php b/wp-includes/version.php index 0571f764fe..ec4239838d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-alpha-41600'; +$wp_version = '4.9-alpha-41601'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.