Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#33093 closed defect (bug) (fixed)

Upgrade from 4.2.2 produces a warning on upgrade

Reported by: lordspace's profile lordspace Owned by: pento's profile pento
Milestone: 4.2.4 Priority: normal
Severity: normal Version: 4.2.2
Component: Upgrade/Install Keywords: needs-patch fixed-major
Focuses: Cc:


Warning: Invalid argument supplied for foreach() in /sites/ on line 1252

Attachments (2)

33093.patch (2.4 KB) - added by kitchin 9 years ago.
33093.2.patch (2.5 KB) - added by markjaquith 9 years ago.
whitespace cleanup

Download all attachments as: .zip

Change History (11)

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

9 years ago

#2 @atomicjack
9 years ago

  • Keywords reporter-feedback added

Did you have wp_debug on or not? Using any plugins or custom themes?

#3 @pento
9 years ago

  • Component changed from Administration to Upgrade/Install
  • Keywords needs-patch added; reporter-feedback removed
  • Milestone changed from Awaiting Review to 4.3
  • Version changed from trunk to 4.2.2

I can see how this warning would've happened, it doesn't need any custom plugins/themes, though it will need WP_DEBUG enabled.

This warning will also occur when upgrading to 4.3, so we should fix it before 4.3 is released, and backport to the 4.2 branch.

#4 @obenland
9 years ago

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

9 years ago

#5 @kitchin
9 years ago

For the patch, I grepped all glob( and skipped SimplePie/Misc.php. Maybe that is an upstream or we want a warning there, don't know. Note (array)false = array(false). Also, as PHP says, "On some systems it is impossible to distinguish between empty match and an error." The glob() emulator in includes/class-ftp.php returns false or array, like PHP.

I don't see any unit tests.

#6 @dmchale
9 years ago

+1 for this patch. We do not have WP_DEBUG enabled anywhere, but noticed some of our sites never automatically updated to 4.2.3 - upon investigating, we found this PHP warning littering the error_log. Logging into the admin area and clicking to upgrade successfully worked, however.

As kitchin said, the php docs definitely mention the possibility of this issue on some systems, per the "Note" blockquote under Return Values. For the most broad system compatability, you can't simply trust a glob() inside a foreach()

9 years ago

whitespace cleanup

#7 @markjaquith
9 years ago

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

In 33447:

Don't blindly trust the output of glob() to be an array.

props kitchin
fixes #33093

#8 @samuelsidler
9 years ago

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

We're going to backport this if/when we have a 4.2.4.

#9 @pento
9 years ago

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

In 33481:

Don't blindly trust the output of glob() to be an array.

Props kitchin.

Merge of [33447] to the 4.2 branch.

Fixes #33093.

Note: See TracTickets for help on using tickets.