#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
Priority: normal Milestone: 3.4
Component: Themes Version: 3.4
Severity: normal Keywords: close
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)

20334.patch (780 bytes) - added by johnjamesjacoby 13 months ago.

Download all attachments as: .zip

Change History (10)

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.

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

In [20330]:

Avoid fatal errors in check_theme_switched() if we fail to get a WP_Theme object for the old theme. Fixes #20334.

  • 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()
Version 0, edited 13 months ago by johnjamesjacoby (next)

This might have been fixed in [20524].

  • Keywords close added

Confirmed fixed. The steps above no longer produce any errors.

Leaving this open to investigate a possible bug in the check_theme_switched() implementation.

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.