WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#26873 closed defect (bug) (fixed)

PHP warning on the Themes page when the active theme is deleted

Reported by: toszcze Owned by: nacin
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.4
Component: Themes Keywords: has-patch commit
Focuses: Cc:

Description

When the active theme is deleted from server, the Themes page shows a PHP warning:

Warning: implode(): Invalid arguments passed in /var/www/wordpress/wp-includes/class-wp-theme.php on line 675

To replicate this bug:

  1. In the admin panel go to Appearance -> Themes
  2. Activate any theme
  3. Remove the activated theme folder from server (or just rename it)
  4. Refresh the Themes page

Attachments (2)

26873.diff (492 bytes) - added by toszcze 6 years ago.
26873.2.diff (956 bytes) - added by SergeyBiryukov 6 years ago.

Download all attachments as: .zip

Change History (7)

@toszcze
6 years ago

#1 @nacin
6 years ago

  • Component changed from General to Themes
  • Milestone changed from Awaiting Review to 3.9
  • Owner set to nacin
  • Status changed from new to reviewing

#2 @SergeyBiryukov
6 years ago

  • Keywords commit added

This should probably be fixed higher up in the stack, in WP_Theme::display().

See 26873.2.diff, which also fixes inaccurate comment about the @return value.

Also discovered #27235 while testing this.

#3 @SergeyBiryukov
6 years ago

  • Version changed from trunk to 3.4

#4 @nacin
6 years ago

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

In 27745:

WP_Theme: Return false from the display() method when get() fails.

Fixes a potential warning on the themes page when the active theme is deleted.

fixes #26873.

#5 @nacin
6 years ago

After looking at this further, I realized display() should notice a get() failure and also issue a false. This fixes the warning. I added some basic test coverage.

Note: See TracTickets for help on using tickets.