Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#29470 closed defect (bug) (fixed)

Language Pack Upgrader can produce a fatal error

Reported by: ocean90 Owned by: ocean90
Milestone: 4.0 Priority: normal
Severity: normal Version: 3.7
Component: Upgrade/Install Keywords: has-patch commit dev-reviewed
Focuses: Cc:

Description (last modified by ocean90)

Language_Pack_Upgrader::bulk_upgrade() returns a WP_Error object when we can't create a language dir.
Language_Pack_Upgrader::upgrade() is just a wrapper for Language_Pack_Upgrader::bulk_upgrade() and returns the first item from $result. That works if $result is an array or even false, but not if it's a WP_Error object:

Fatal error: Cannot use object of type WP_Error as array in /src/wp-admin/includes/class-wp-upgrader.php on line 1229

Introduced in [25633]/#22704.

Attachments (1)

29470.patch (564 bytes) - added by ocean90 6 years ago.

Download all attachments as: .zip

Change History (6)

6 years ago

#1 @ocean90
6 years ago

  • Milestone changed from Awaiting Review to 4.0

Moving to 4.0 because of #29397.

#2 @nacin
6 years ago

  • Keywords commit dev-reviewed added

Oof, looks good.

#3 @ocean90
6 years ago

  • Description modified (diff)

#4 @ocean90
6 years ago

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

In 29675:

Language Pack Upgrader: Check return value before accessing the first array key.

Prevents a fatal error when Language_Pack_Upgrader::bulk_upgrade() returns a WP_Error object.

fixes #29470.

#5 @jdgrimes
5 years ago

#29089 was marked as a duplicate.

Note: See TracTickets for help on using tickets.