WordPress.org

Make WordPress Core

Opened 13 months ago

Closed 8 months ago

Last modified 8 months ago

#44770 closed defect (bug) (fixed)

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

Reported by: dlh Owned by: 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 13 months ago.

Download all attachments as: .zip

Change History (12)

@dlh
13 months ago

#1 @westonruter
13 months ago

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

Good catch.

#2 @SergeyBiryukov
13 months 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
13 months ago

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

Reopening for 4.9.9 consideration.

#4 @SergeyBiryukov
12 months 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
11 months 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
11 months 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
11 months ago

  • Milestone changed from 4.9.9 to 5.0.1

#8 @pento
8 months ago

  • Milestone changed from 5.0.1 to 5.0.2

#9 @pento
8 months ago

  • Milestone changed from 5.0.2 to 5.0.3

#10 @desrosj
8 months 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
8 months ago

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