Skip to content

Commit

Permalink
bugfix: Content disappears when function are messing around with ob_*
Browse files Browse the repository at this point in the history
Calling functions should be pretty straight forward.
But we are doomed as soon as we rely on WordPress itself or Plugins
to end the OB-Caching-Levels properly.
Unfortunately we need to take care of this around the functions.
  • Loading branch information
rmp-up committed Jun 21, 2021
1 parent 8b1bfed commit 623d693
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion includes/internals.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ function _wp_twig_env_generic_delegate( Environment $environment ) {
function _wp_twig_generic_delegate_target( $name ) {
if ( function_exists( $name ) ) {
return static function () use ( $name ) {
return call_user_func_array( $name, func_get_args() );
$level = ob_get_level();
$returnValue = call_user_func_array( $name, func_get_args() );
while (ob_get_level() > $level) {
ob_end_flush();
}

return $returnValue;
};
}

Expand Down

0 comments on commit 623d693

Please sign in to comment.