Problem/Motivation

In production environments, the Tablefield module triggers a PHP warning when calling ob_clean() while no output buffer is active.

Steps to reproduce

This issue does not reproduce locally, likely due to differences in PHP configuration (e.g. output_buffering, zlib.output_compression) or execution order. When the output buffer may already be closed when Tablefield executes ob_clean(), resulting in the following warning:

ob_clean(): failed to delete buffer. No buffer to delete

This can cause noisy logs or, depending on error handling, break the request.

Proposed resolution

Wrap the ob_clean() call with a defensive check to ensure an active output buffer exists before attempting to clean it. For example:

if (ob_get_level() > 0) {
  ob_clean();
}

Comments

zahord created an issue. See original summary.

zahord’s picture

Patch was attached

zahord’s picture

Status: Active » Needs review
liam morland’s picture

Version: 3.0.0 » 3.0.x-dev
Status: Needs review » Needs work

Thanks for the patch. Please use an issue fork and merge request.