Fix: Prevent warnings from displaying in form iframe #7021
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This addresses feedback such as: https://feedback.givewp.com/next-gen/p/deprecated-error-notice-when-attempting-to-migrate-a-20-form-to-30
If any kind of deprecation, error, warning, or just plain anything is written to the output buffer, it's currently showing up inside our forms and confirmation receipts. It's fine for things to show up in other places, but we specifically don't want them to show up there, in front of donors.
This clears the output buffer and sets
ini_set('display_errors', 0)
to prevent PHP errors (which supersedes the output buffer). This isn't a perfect system, as any errors/warnings that occur before theini_set
will still show up. As such, I put them in the router closures as the earliest point in time we could squelch the errors.Affects
The form rendering routes
Visuals
Without this PR:
Testing Instructions
Use the WordPress Beta Test plugin to update to WP 6.4 beta. Then preview the form in the Form Builder (design mode), and make a donation on the front end.
Pre-review Checklist