Fix output buffer fatal error due to not properly handling class method output callbacks#1453
Merged
Merged
Conversation
Contributor
|
This one was fun to find. 🐞 Thanks for digging in, @westonruter! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When activating the
all-in-one-seo-packplugin, an error shows up in the error log when validating a URL:The underlying code in the plugin that causes the problem is the adding of the
All_in_One_SEO_Pack ::output_callback_for_title()method as an output buffer callback in:https://github.com/semperfiwebdesign/all-in-one-seo-pack/blob/982cbb6a6ba183cf538d86b858273505a417720f/aioseop_class.php#L3496
The AMP plugin is supposed to prevent this error from happening via the
AMP_Validation_Manager::can_output_buffer()method. It turns out there was a flaw in the logic being used to convert a function on the call stack into the format expected byob_list_handlers(). In particular, it was not handling the case where an output callback was a class method. The issue is fixed by properly detecting when a call stack entry is for a class method.This pull request also improves error message shown when a
validate_urlcall fails. Instead of showing an error code likeresponse_comment_absentit will now show a full message explaining what is going on. This change also adds WSOD (whitescreen of death detection) as a more specific error case for when the JSON comment is absent: