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
merged 2 commits into from Sep 22, 2018

Conversation

Projects
None yet
3 participants
@westonruter
Copy link
Member

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:

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 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:

image

westonruter added some commits Sep 22, 2018

@westonruter westonruter added this to the v1.0 milestone Sep 22, 2018

@amedina
Copy link
Member

left a comment

Ship it.

@westonruter westonruter merged commit 220800d into develop Sep 22, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@westonruter westonruter deleted the fix/can-output-buffer-method-callbacks branch Sep 22, 2018

@postphotos

This comment has been minimized.

Copy link
Contributor

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
You can’t perform that action at this time.