Make WordPress Core

Opened 12 years ago

Closed 11 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 Owned by: SergeyBiryukov
Priority: low Milestone: 4.2
Component: Filesystem API Version: 4.0
Severity: minor Keywords: has-patch
Cc: Focuses:

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 12 years ago.

Download all attachments as: .zip

Change History (8)

@ocean90
12 years ago

#1 @nacin
12 years ago

  • Milestone Awaiting Review4.1.1

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

#2 @valendesigns
12 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
12 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

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
12 years ago

  • Keywords fixed-major added
  • Resolution fixed
  • Status closedreopened

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


12 years ago

#6 @dd32
11 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
11 years ago

  • Keywords fixed-major removed
  • Milestone 4.1.14.2
  • Resolutionfixed
  • Status reopenedclosed
Note: See TracTickets for help on using tickets.