Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#30827 closed defect (bug) (fixed)

wp_can_install_language_pack(): Direct access to $upgrader->fs_connect() can produce undefined index notices

Reported by: ocean90's profile ocean90 Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.2 Priority: low
Severity: minor Version: 4.0
Component: Filesystem API Keywords: has-patch
Focuses: Cc:

Description

Example: Notice: Undefined index: fs_no_content_dir in /src/wp-admin/includes/class-wp-upgrader.php on line 182

That's because the init() method isn't called here, which sets up the strings. We should either do $upgrader->init() or $upgrader->generic_strings().

Attachments (1)

30827.patch (530 bytes) - added by ocean90 10 years ago.

Download all attachments as: .zip

Change History (8)

@ocean90
10 years ago

#1 @nacin
10 years ago

  • Milestone changed from Awaiting Review to 4.1.1

I see no harm in fixing or not fixing this in 4.1.1.

#2 @valendesigns
10 years ago

@ocean90 What are the steps to reproduce the notices? I want to test your patch but am having trouble getting PHP to throw a notice during language pack installation.

#3 @SergeyBiryukov
10 years ago

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

In 31074:

Call the init() method for the upgrader in wp_can_install_language_pack() to avoid undefined index notices.

props ocean90.
fixes #30827 for trunk.

#4 @SergeyBiryukov
10 years ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

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


10 years ago

#6 @dd32
10 years ago

I'm so-so on including this in 4.1.1, I could go either way, unless someone feels strongly, lets close it on 4.2.

Realistically, it's only a PHP notice, and none of the strings missing should be needed during a translation install, it's also unlikely any other alterations will be made to this file in 4.1.1 (meaning one less file in a 4.1 -> 4.1.1 update).

Worst case, as @ocean90 hit here, the upgrade can't find the wp-content directory and it emits a PHP notice + fs_no_content_dir instead of a human-readable message.. a case that should be exceedingly rare.

#7 @SergeyBiryukov
10 years ago

  • Keywords fixed-major removed
  • Milestone changed from 4.1.1 to 4.2
  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.