diff --git a/wire/core/WireCache.php b/wire/core/WireCache.php index 531e24e4..0fc42d03 100644 --- a/wire/core/WireCache.php +++ b/wire/core/WireCache.php @@ -341,16 +341,18 @@ class WireCache extends Wire { } ob_start(); - - if(count($args)) { - $value = call_user_func_array($func, $args); - } else { - $value = $func(); + + try { + if(count($args)) { + $value = call_user_func_array($func, $args); + } else { + $value = $func(); + } + } finally { // PHP 5.5+ + $out = ob_get_contents(); + ob_end_clean(); } - $out = ob_get_contents(); - ob_end_clean(); - if(empty($value) && !empty($out)) $value = $out; if($value !== false) {