WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#1845 closed defect (bug) (fixed)

In upgrade.php, if the 'current theme' is not working correctly or doesn't exist, then set wp_options template and stylesheet to default

Reported by: MichaelH Owned by: morydd
Milestone: Priority: normal
Severity: normal Version: 1.6
Component: General Keywords: bg|2nd-opinion bg|has-patch|needs review
Focuses: Cc:

Description

In upgrade.php, if the 'current theme' is not working correctly or doesn't exist, then set wp_options template and stylesheet to default.

This should help alleviate the hundreds of "I've got a blank screen after I did the upgrade.php" questions that get asked in the Forums.

The wp-admin/themes.php displays the message "The active theme is broken. Reverting to the default theme"; that's what upgrade.php should do so you don't get the blank screen after an almost perfect upgrade otherwise.

Attachments (1)

1845.diff (1.1 KB) - added by morydd 13 years ago.
update to check if theme is valid, and if not revert to default.

Download all attachments as: .zip

Change History (7)

#1 @morydd
13 years ago

  • Owner changed from anonymous to morydd
  • Status changed from new to assigned

@morydd
13 years ago

update to check if theme is valid, and if not revert to default.

#2 @morydd
13 years ago

  • Keywords has_patch added

The patch above checks (using the same tests as in validate_current_theme() ) if the currently loaded theme is valid. If it fails, it switches to the default theme. If the default is also missing, it will give the user a message along with a link to the codex. This should prevent a missing theme from presenting a blank page.

I'm sure there's a better way to do the refresh in line 13 of the patched file, but this seems to do the job.

#3 @morydd
13 years ago

  • Keywords bg|2nd-opinion added; has_patch removed

#4 @morydd
13 years ago

  • Keywords bg|has-patch added

#5 @MichaelH
13 years ago

  • Keywords bg|has-patch|needs review added; bg|has-patch removed

To duplicate: in a 1.5 blog, set current theme to something other than the default theme; remove all 1.5 files except wp-config.php (yes, delete wp-content--crazy!! but real users do that all the time), upload 1.6 files, run upgrade.php and after clicking on the "Have Fun!" link you should see "Please Reload This Page" as a link on a blank page.

Tested upgrade.php 4 times. Three (3) of the tests were on blogs where Blog URI and the WordPress URI were different and one (1) test on a local XAMPP install where Blog and WordPress URIs matched. Two of the upgrades displayed the "Please Reload This Page" then after a second or two redirected to the blog using the "WordPress Default 1.5" theme. That's Good!

But, in two cases, both where Blog and WordPress URIs did not match, it stopped at the "Please Reload This Page" link. At that point clicking on that link resulted in:

a browser address showing as: http://www.sample.com/index.php%3Chtml

Not Found
The requested URL /index.php<html was not found on this server.

Apache/1.3.31 Server at sample.com Port 80

Other Info: Blog Uri is: http://www.sample.com WordPress Uri is: http://www.sample.com/wpblog

#6 @davidhouse
12 years ago

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

Was a dupe of #2305, fixed in [3459].

Note: See TracTickets for help on using tickets.