If running PHP in command line mode, by default there are no buffer levels.
However, when the request is from a browser, the default buffer level is 1.
So, at the end of the script, add the following.
if (ob_get_length() && ob_get_level() > 1) {The "ob_get_length()" checks if there is any data in the current buffer.
error_log("ERROR: Output buffering leakage detected: ({$_SERVER['REQUEST_METHOD']}) {$_SERVER['REQUEST_URI']}");
error_log("ERROR: Output buffering args:\n" . print_r($_SERVER['argv'], true));
}
Typically this would be sufficient in command line, but since a browser request has one level of buffer set, we need to also check "ob_get_level()".