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

Keep track of the callbacks run (and their sources) when a filter is applied #1016

Merged
merged 1 commit into from
Mar 13, 2018

Conversation

westonruter
Copy link
Member

  • Wrap the_content and the_excerpt in AMP stack source comments to reveal which filters are responsible for the resulting content, since not any one filter callback can be identified as the culprit for invalid content.
  • Remove spurious apostrophe from callback class name.
  • Prevent PHP notice when doing summarize_validation_errors if a source has no type or name.

If I enter an excerpt that contains:

This is <b onclick=EVIL>awesome</b> food

Now this results in the validation error containing the filter that is applied (the_excerpt), the current post global, and the filter callbacks added and their sources:

image

This will greatly help with debugging AMP validation errors related to filters, where previously there was only good validation debugging for actions.

…applied

* Wrap the_content and the_excerpt in AMP stack source comments to reveal which filters are responsible for the resulting content, since not any one filter callback can be identified as the culprit for invalid content.
* Remove spurious apostrophe from callback class name.
* Prevent PHP notice when doing summarize_validation_errors if a source has no type or name.
@westonruter westonruter requested a review from kienstra March 12, 2018 22:54
@westonruter westonruter added this to the v0.7 milestone Mar 12, 2018
@westonruter
Copy link
Member Author

Here's what it looks like when there is invalid content output by a shortcode: both the shortcode being applied and the filter (the_content) is captured in the source stack trace:

image

Copy link
Contributor

@kienstra kienstra left a comment

Choose a reason for hiding this comment

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

Approved

Hi @westonruter,
This looks good. It's nice how it has a stack trace of the filter.

@westonruter westonruter merged commit 3f3687f into develop Mar 13, 2018
@westonruter westonruter deleted the add/filter-source-stack branch March 13, 2018 00:38
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.

2 participants