Opened 9 months ago
Last modified 9 months ago
#21931 reopened enhancement
White screen of death if theme can't be found
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Themes | Version: | |
| Severity: | normal | Keywords: | 2nd-opinion dev-feedback |
| Cc: | mdhansen@… |
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)
Change History (18)
MikeHansenMe
— 9 months ago
comment:1
MikeHansenMe
— 9 months ago
comment:2
MikeHansenMe
— 9 months ago
- Cc mdhansen@… added
comment:3
miqrogroove
— 9 months ago
comment:4
miqrogroove
— 9 months ago
- Resolution set to duplicate
- Status changed from new to closed
Duplicate of #11282.
comment:5
SergeyBiryukov
— 9 months ago
- Resolution duplicate deleted
- Status changed from closed to reopened
Related, but not exactly a duplicate.
comment:6
follow-up:
↓ 7
scribu
— 9 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
ericlewis
— 9 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:
↓ 14
scribu
— 9 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:
↓ 10
MikeHansenMe
— 9 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
ericlewis
— 9 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.
comment:11
scribu
— 9 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.
SergeyBiryukov
— 9 months ago
comment:12
SergeyBiryukov
— 9 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).
comment:13
follow-up:
↓ 15
MikeHansenMe
— 9 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
johnbillion
— 9 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:
↓ 16
SergeyBiryukov
— 9 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
MikeHansenMe
— 9 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.
I think this is a good idea as most users would not know where to begin looking if they experienced a white screen.