#41621 closed defect (bug) (fixed)
Customize: Removing setting from changeset generates PHP warning
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Customize | Keywords: | has-patch |
Focuses: | Cc: |
Description
WP_Customize_Manager::save_changeset_post()
includes a check for array_key_exists( 'value', $setting_params )
while looping through $args['data']
.
This check can generate a warning when removing a setting from the changeset by passing 'setting_id' => null
.
The attached patch includes a PHPUnit test demonstrating the issue; it should also be replicable in JS by calling wp.customize.requestChangesetUpdate( { 'setting_id': null } )
.
The patch would verify that $setting_params
is an array before checking array_key_exists()
.
Attachments (1)
Change History (5)
#1
@
8 years ago
- Milestone changed from Awaiting Review to 4.9
- Owner set to westonruter
- Status changed from new to reviewing
#4
in reply to:
↑ 2
@
8 years ago
Replying to westonruter:
@dlh @stubgo did you encounter this in writing unit tests for the
changesets
REST API endpoint? If not, could you add a unit test for it there as well to ensure that this use case is tested?
I encountered it separately from the endpoints, but it looks like @stubgo already wrote a test for it: https://github.com/WP-API/wp-api-customize-endpoints/blob/304196b1e65382393c10f883e3e1e050b54bc3a4/tests/test-customize-changesets-controller.php#L1906.
@dlh @stubgo did you encounter this in writing unit tests for the
changesets
REST API endpoint? If not, could you add a unit test for it there as well to ensure that this use case is tested?