Make WordPress Core

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#44770 closed defect (bug) (fixed)

Customize: `option_{$option}` filter applied with a missing parameter

Reported by: dlh's profile dlh Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.0.3 Priority: normal
Severity: normal Version: 4.4
Component: Customize Keywords:
Focuses: Cc:

Description

WP_Customize_Widgets::capture_filter_pre_get_option() applies the option_{$option} filter to the captured value, but without the second $option parameter added in WordPress 4.4.

The missing parameter has the potential to generate fatal errors in PHP 7.1 and above from uncaught ArgumentCountError exceptions if a function is hooked to the filter that accepts both parameters.

The attached patch would add the second parameter to the apply_filters() call.

Attachments (1)

44770.diff (587 bytes) - added by dlh 6 years ago.

Download all attachments as: .zip

Change History (12)

@dlh
6 years ago

#1 @westonruter
6 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 4.9.9

Good catch.

#2 @SergeyBiryukov
6 years ago

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

In 43561:

Customize: Pass missing parameter to dynamic option_{$option} filter in WP_Customize_Widgets::capture_filter_pre_get_option().

Props dlh.
Fixes #44770.

#3 @SergeyBiryukov
6 years ago

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

Reopening for 4.9.9 consideration.

#4 @SergeyBiryukov
6 years ago

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

In 43611:

Customize: Pass missing parameter to dynamic option_{$option} filter in WP_Customize_Widgets::capture_filter_pre_get_option().

Props dlh.
Fixes #44770.

#5 @pento
5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

[43611] needs to be reverted from the 4.9 branch. This issue should then be milestoned for 5.0.1.

#6 @SergeyBiryukov
5 years ago

In 43701:

Customize: Revert [43611] from the 4.9 branch.

This change is out of the 4.9.x scope, and will be reintroduced in 5.0.x.

See #44770.

#7 @SergeyBiryukov
5 years ago

  • Milestone changed from 4.9.9 to 5.0.1

#8 @pento
5 years ago

  • Milestone changed from 5.0.1 to 5.0.2

#9 @pento
5 years ago

  • Milestone changed from 5.0.2 to 5.0.3

#10 @desrosj
5 years ago

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

In 44387:

Customize: Pass missing parameter to dynamic option_{$option} filter in WP_Customize_Widgets::capture_filter_pre_get_option().

This prevents a potential fatal error from an ArgumentCountError exception in PHP 7.1 or greater

Props dlh.

Merges [43561] to the 5.0 branch.
Fixes #44770.

#11 @desrosj
5 years ago

  • Keywords has-patch commit fixed-major removed
Note: See TracTickets for help on using tickets.