WordPress.org

Make WordPress Core

Opened 19 months ago

Last modified 3 months ago

#21931 reopened enhancement

White screen of death if theme can't be found

Reported by: ericlewis Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Themes Keywords: 2nd-opinion dev-feedback ux-error-recovery
Focuses: Cc:

Description

If the current theme can't be found or is renamed, the front-end of the site will white screen. This is developer error, as when WP_USE_THEMES is true, the template loader should always have a template to load (as far as I understand).

It's rare, but I come across it every once in a while in developing. It might be nice to have a wp_die() if a proper template can't be found in template-loader.

Proof of concept:

if ( $template = apply_filters( 'template_include', $template ) )
	include( $template );
else
	wp_die("Whoops! Looks like you're missing a theme.");

Attachments (2)

21931.diff (537 bytes) - added by MikeHansenMe 19 months ago.
21931.2.diff (497 bytes) - added by SergeyBiryukov 19 months ago.

Download all attachments as: .zip

Change History (21)

MikeHansenMe19 months ago

comment:1 MikeHansenMe19 months ago

I think this is a good idea as most uses would not know where to begin looking if they experienced a white screen.

Version 0, edited 19 months ago by MikeHansenMe (next)

comment:2 MikeHansenMe19 months ago

  • Cc mdhansen@… added

comment:3 miqrogroove19 months ago

Last edited 19 months ago by miqrogroove (previous) (diff)

comment:4 miqrogroove19 months ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #11282.

comment:5 SergeyBiryukov19 months ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

Related, but not exactly a duplicate.

comment:6 follow-up: scribu19 months ago

I've also run into this. Should be careful with the error message, since it can show up on live sites in certain circumstances.

comment:7 in reply to: ↑ 6 ericlewis19 months ago

Replying to scribu:

Should be careful with the error message, since it can show up on live sites in certain circumstances.

Can you expand on that? I can't imagine the circumstance where $template is expected to be empty.

comment:8 follow-up: scribu19 months ago

I remember I screwed up a deploy once and the theme was renamed. Since I had deleted the twentyeleven theme, I got a WSOD. With this bug, I would get a message instead.

What I'm saying is that the error message shouldn't assume that it will only be seen by developers.

comment:9 follow-up: MikeHansenMe19 months ago

what about "Looks like the website is having theme trouble, please notify the site owner" or something to that effect?

comment:10 in reply to: ↑ 9 ericlewis19 months ago

After chatting with Nacin in IRC a bit, some thought has to be put in here in regard to the ambiguity of the problem, and the ambiguity of the audience. This situation may arise from not just the themes folder missing, it may be a filesystem error, or come from another unknown cause. Therefore, our presentation of the error should respect this fact, and not send developers with possibly misleading debug information.

Last edited 19 months ago by ericlewis (previous) (diff)

comment:11 scribu19 months ago

It's nearly the same thing, but not quite; as the developer, you can at least know that WP was loaded.

And if there's a hook available, you can write a plugin that outputs a more useful message or logs it somewhere.

SergeyBiryukov19 months ago

comment:12 SergeyBiryukov19 months ago

Could we do something along the lines of what wp_dashboard_right_now() does?
http://core.trac.wordpress.org/browser/tags/3.4.2/wp-admin/includes/dashboard.php#L365

If the current theme is not found, 21931.2.diff shows "The theme directory does not exist".

Related: #21670 (for more exact message in the admin).

Last edited 19 months ago by SergeyBiryukov (previous) (diff)

comment:13 follow-up: MikeHansenMe19 months ago

The thing about using Right Now in the dashboard to deliver messages is that it can be turned off. Perhaps there is a problem with that as well. Either not allow right now to be turned off or move error messages above the separate content blocks?

comment:14 in reply to: ↑ 8 johnbillion19 months ago

Replying to scribu:

What I'm saying is that the error message shouldn't assume that it will only be seen by developers.

Let's make the message capability-dependant then.

if ( current_user_can( 'switch_themes' ) )
	$message = __( 'You just broke everything!' );
else
	$message = __( 'Everything is fine and we will be back shortly.' );

wp_die( $message );

comment:15 in reply to: ↑ 13 ; follow-up: SergeyBiryukov19 months ago

Replying to MikeHansenMe:

The thing about using Right Now in the dashboard to deliver messages is that it can be turned off.

The idea behind 21931.2.diff was to display a similar message on the front end.

comment:16 in reply to: ↑ 15 MikeHansenMe19 months ago

Replying to SergeyBiryukov:

Replying to MikeHansenMe:

The thing about using Right Now in the dashboard to deliver messages is that it can be turned off.

The idea behind 21931.2.diff was to display a similar message on the front end.

I thought you were suggesting a user message in the front and developer error in the admin. I do think giving the error on the front end is a good idea because like I said, the Right Now area in the admin can be turned off. I think that may be a problem of it's own though.

comment:17 ericlewis8 months ago

  • Keywords ux-error-recovery added

comment:19 ircbot3 months ago

This ticket was mentioned in IRC in #wordpress-dev by tierra. View the logs.

Note: See TracTickets for help on using tickets.