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

Fix output buffer fatal error due to not properly handling class method output callbacks #1453

merged 2 commits into from Sep 22, 2018


Copy link

@westonruter westonruter commented Sep 22, 2018

When activating the all-in-one-seo-pack plugin, an error shows up in the error log when validating a URL:

PHP Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers

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:

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 by ob_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_url call fails. Instead of showing an error code like response_comment_absent it 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:


westonruter added 2 commits Sep 22, 2018
@westonruter westonruter added this to the v1.0 milestone Sep 22, 2018
Copy link

@amedina amedina left a comment

Ship it.

@westonruter westonruter merged commit 220800d into develop Sep 22, 2018
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed
@westonruter westonruter deleted the fix/can-output-buffer-method-callbacks branch Sep 22, 2018
Copy link

@postphotos postphotos commented Sep 22, 2018

This one was fun to find. 🐞 Thanks for digging in, @westonruter!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.