Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WP-r43578: Customize: Safeguard a check on the customize_validate_{$setting_id} filter value to ensure it is a WP_Error. #353

Closed

Conversation

PaoloFalomo
Copy link
Contributor

@PaoloFalomo PaoloFalomo commented Jan 30, 2019

WP-r43578: Customize: Safeguard a check on the customize_validate_{$setting_id} filter value to ensure it is a WP_Error.

While the filter is documented to only support a WP_Error, it has been a common practice to return true in a validation function if no errors have occurred. This was already caught when the same filter was executed in WP_Customize_Setting, it was however missing in WP_Customize_Manager::validate_setting_values().

Fixes https://core.trac.wordpress.org/ticket/44809.

Conflicts:
src/wp-includes/class-wp-customize-manager.php

Merges https://core.trac.wordpress.org/changeset/43578 / WordPress/wordpress-develop@1e4e60f11c to ClassicPress.

WP-r43578: Customize: Safeguard a check on the `customize_validate_{$setting_id}` filter value to ensure it is a `WP_Error`.

While the filter is documented to only support a `WP_Error`, it has been a common practice to return true in a validation function if no errors have occurred. This was already caught when the same filter was executed in `WP_Customize_Setting`, it was however missing in `WP_Customize_Manager::validate_setting_values()`.

Fixes https://core.trac.wordpress.org/ticket/44809.

Conflicts:
  src/wp-includes/class-wp-customize-manager.php
----
Merges https://core.trac.wordpress.org/changeset/43578 / WordPress/wordpress-develop@1e4e60f11c to ClassicPress.
@Mte90 Mte90 changed the title Customize: Safeguard a check on the customize_validate_{$setting_id} filter value to ensure it is a WP_Error. WP-r43578: Customize: Safeguard a check on the customize_validate_{$setting_id} filter value to ensure it is a WP_Error. Jan 30, 2019
Copy link
Contributor

@nylen nylen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were 16 errors:

1) Tests_WP_Customize_Manager::test_changeset_data
Error: Call to undefined method WP_Error::has_errors()

etc.

Maybe this changeset depends on another one that has not been merged yet?

@Mte90
Copy link
Contributor

Mte90 commented Jan 31, 2019

Looking the has_errors is a method added in 5.1 https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-error.php#L171
So probably is better to use https://core.trac.wordpress.org/changeset/44392 that is for 5.0.
This can be closed and we need a backport of that changeset that should not create issues.
We need to be more careful on selecting the changeset but in this case probably the issue is the release cycle of 5.0/5.1 where they moved a lot of changeset so the last one in the ticket is not the right rule.

@Mte90
Copy link
Contributor

Mte90 commented Mar 11, 2019

CLosed for #398

@Mte90 Mte90 closed this Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants