WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#35521 closed defect (bug) (fixed)

Avoid PHP errors if no theme directory exists

Reported by: iseulde Owned by: swissspidy
Milestone: 4.8 Priority: normal
Severity: normal Version:
Component: Themes Keywords: has-patch
Focuses: Cc:

Description

Warning: Invalid argument supplied for foreach() in .../wp-admin/theme-install.php on line 31

Warning: array_keys() expects parameter 1 to be array, boolean given in .../wp-admin/theme-install.php on line 57

Attachments (5)

35521.patch (856 bytes) - added by iseulde 3 years ago.
35521.2.patch (697 bytes) - added by iseulde 3 years ago.
35521.3.diff (1.5 KB) - added by chris_dev 3 years ago.
I did it in a different way. I kept the search_theme_directories() function.
35521.diff (645 bytes) - added by swissspidy 2 years ago.
35521.2.diff (479 bytes) - added by swissspidy 2 years ago.

Download all attachments as: .zip

Change History (18)

@iseulde
3 years ago

#1 @iseulde
3 years ago

  • Keywords has-patch added

@obenland Could you take a second look?

@iseulde
3 years ago

#2 @iseulde
3 years ago

New patch, messed it up. Just make sure an array is always returned.

@chris_dev
3 years ago

I did it in a different way. I kept the search_theme_directories() function.

#3 @chris_dev
3 years ago

  • Keywords needs-testing added

#4 @chris_dev
3 years ago

  • Keywords 2nd-opinion added

#5 @obenland
3 years ago

@iseulde have you looked at #24026 and #11282?

#6 @iseulde
3 years ago

Sure, not sure if they're the same errors.

This ticket was mentioned in Slack in #core by chriscct7. View the logs.


3 years ago

#8 @mikeschroder
3 years ago

  • Owner set to iseulde
  • Status changed from new to assigned

@iseulde Do you still want to tackle this in 4.5?

This ticket was mentioned in Slack in #core by chriscct7. View the logs.


3 years ago

#10 @obenland
3 years ago

  • Milestone changed from 4.5 to Future Release

#11 @swissspidy
2 years ago

  • Owner changed from iseulde to swissspidy
  • Status changed from assigned to reviewing

@swissspidy
2 years ago

@swissspidy
2 years ago

#12 @swissspidy
2 years ago

  • Keywords needs-testing 2nd-opinion removed
  • Milestone changed from Future Release to 4.8

The first two patches could cause back compat issues. 35521.3.diff seems to fix things in the wrong place.

35521.diff is basically just one line.

#13 @swissspidy
2 years ago

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

In 40636:

Themes: Avoid PHP warnings in the admin when no theme directory exists.

Props iseulde, chris_dev, swissspidy.
Fixes #35521.

Note: See TracTickets for help on using tickets.