Opened 13 years ago
Closed 13 years ago
#20334 closed defect (bug) (fixed)
check_theme_switched() will Fatal Error if the old theme cannot be found for some reason
Reported by: | westi | Owned by: | westi |
---|---|---|---|
Milestone: | 3.4 | Priority: | normal |
Severity: | normal | Version: | 3.4 |
Component: | Themes | Keywords: | close |
Focuses: | Cc: |
Description
In check_theme_switched()
we assume that we can get a WP_Theme object for the old theme.
If this fails because the theme no longer exists or the option data doesn't match an available theme then we try and call a method on an object which doesn't exist.
Attachments (1)
Change History (10)
#4
@
13 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
This is still not completely fixed. Easiest way to duplicate is by renaming a theme in it's style.css when you're already at wp-admin/themes.php.
- Visit wp-admin/themes.php
- Rename any theme in style.css
- Refresh wp-admin/themes.php
- Fatal error: Call to a member function exists() on a non-object in /wp.local/wp/wp-includes/theme.php on line 1557
- Error points to check_theme_switched()
Patch below circumvents the problem without digging too deep into the API.
Note: See
TracTickets for help on using
tickets.
As I said to westi in IRC, the theme_switched option is only supposed to exist until the next pageload. So if it still exists, then you have bigger problems. I'm definitely fine with checking the return value of wp_get_theme() and using the raw $stylesheet if necessary.