close
Skip to content

Commit dcac3ba

Browse files
authored
Merge pull request #736 from WordPress/fix-output-buffer
Make `Server-Timing` header output more robust
2 parents 86a7776 + 4e83589 commit dcac3ba

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

‎server-timing/class-perflab-server-timing.php‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,11 @@ public function on_template_include( $passthrough = null ) {
227227
return $passthrough;
228228
}
229229

230-
ob_start();
231-
add_action(
232-
'shutdown',
233-
function() {
234-
$output = ob_get_clean();
230+
ob_start(
231+
function( $output ) {
235232
$this->send_header();
236-
echo $output;
237-
},
238-
// phpcs:ignore PHPCompatibility.Constants.NewConstants
239-
defined( 'PHP_INT_MIN' ) ? PHP_INT_MIN : -1000
233+
return $output;
234+
}
240235
);
241236
return $passthrough;
242237
}

0 commit comments

Comments
 (0)