WordPress.org

Make WordPress Core

#44104 closed defect (bug) (fixed)

Customize: Attempt to count uncountable value

Reported by: dlh Owned by: azaozz
Milestone: 4.9.8 Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: has-patch has-unit-tests commit fixed-major
Focuses: Cc:

Description

WP_Customize_Nav_Menus::search_available_items_query() attempts to count an instance of WP_Customize_Setting, which generates a warning in PHP 7.2.

It looks to me like the intent was to count the value of the setting instead, which should be an array.

Attachments (2)

44104.diff (811 bytes) - added by dlh 16 months ago.
44104.2.diff (1.3 KB) - added by dlh 15 months ago.

Download all attachments as: .zip

Change History (10)

@dlh
16 months ago

#1 @SergeyBiryukov
16 months ago

  • Milestone changed from Awaiting Review to 4.9.7

#2 @desrosj
16 months ago

  • Milestone changed from 4.9.7 to 4.9.8

Moving all tickets in 4.9.7 to 4.9.8.

#3 @pbiron
15 months ago

  • Keywords needs-unit-tests added

@dlh
15 months ago

#4 @dlh
15 months ago

  • Keywords has-unit-tests added; needs-unit-tests removed

It looks to me like this warning can be generated in the existing test for search_available_items_query() by ensuring that the nav_menus_created_posts setting has been added, which can be done by calling do_action( 'customize_register' ) at the beginning of the test. test_save_nav_menus_created_posts() uses a similar pattern. 44104.2.diff adds that line to the test.

#5 @pento
14 months ago

  • Keywords commit added

This is ready for commit and backport.

#6 @azaozz
14 months ago

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

In 43480:

Customize: Do not attempt to count uncountable value.

Props dlh.
Fixes #44104.

#7 @azaozz
14 months ago

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

Reopen for 4.9.8.

#8 @azaozz
14 months ago

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

In 43481:

Customize: Do not attempt to count uncountable value.

Props dlh.
Merges [43480] to the 4.9 branch.
Fixes #44104.

Note: See TracTickets for help on using tickets.