Heads-up on issue with output buffering
-
Hey guys,
Thanks for the great plugin ?? Just wanted to give you a heads-up about a minor bug that took me a while to track down.
In the
wdi_feed()
function in shortcode.php, the function opens withob_start()
and
return ob_get_clean()
which is great.
But in the middle, there’s also the possibility of another return for an Invalid Shortcode error
if ($attributes['id']=='no_id'){ return __('Invalid shortcode', "wdi"); }
This means that the function can return without closing the output buffer.
The upshot is that if you don’t close the buffer here, the buffered content gets echoed, which can screw up other plugins that are using output buffering, with your widget inside.
Simple fix, just make sure the buffer gets closed before returning:
if ($attributes['id']=='no_id'){ ob_get_clean(); return __('Invalid shortcode', "wdi"); }
This fixes the issue in my tests.
Hope that’s helpful – thanks, guys!
Chris
- The topic ‘Heads-up on issue with output buffering’ is closed to new replies.